In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you the "sample analysis of XDocument and XmlDocument in XML", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and study the "sample analysis of XDocument and XmlDocument in XML".
XmlDocument StringBuilder str = new StringBuilder (); XmlDocument document = new XmlDocument (); document.Load ("List1.xml"); XmlNodeList nodelist = document.GetElementsByTagName ("person"); foreach (XmlNode item in nodelist) {str.Append (item.FirstChild.InnerText.ToString ()) Str.Append ("");} textBox1.Text = str.ToString ()
You can get the specified name or ID through document, which is the specified name. Then output the contents of the first child node under the name node by traversing.
XDocument XDocument document = XDocument.Load ("List1.xml"); XElement rootElement = document.Root; IEnumerable ie = rootElement.Descendants ("person") .Where (x = > Convert.ToInt32 (x.Attribute ("id"). Value) > 1); foreach (var item in ie) {textBox1.Text + = item.Attribute ("id"). Value+ "\ t";}
Through XDocument, we can query the data we need more conveniently and quickly, which can be retrieved with lambda expressions.
The above is all the content of the article "sample Analysis of XDocument and XmlDocument in XML". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.