更新时间:2023-02-23 23:22:33
使用以下方法之一解析XML:
Use one of the following ways to parse XML:
System.Xml.XmlDocument
类.它实现了DOM接口;如果文档太大,则这种方法最简单,也足够好.System.Xml.XmlTextReader
; library/system.xml.xmldocument.aspx"target =" _ blank"title =" New Window> ^ System.Xml.XmlTextReader
;这是最快的读取方法,尤其是您需要跳过一些数据.System.Xml.XmlDocument
class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.System.Xml.XmlTextReader
; this is the fastest way of reading, especially is you need to skip some data.System.Xml.Linq.XDocument
; this is the most adequate way similar to that of XmlDocument
, supporting LINQ to XML Programming.
您是否需要输入元素名称或值?无论如何,请使用属性TextBox.Text
.
Do you need to put the element name or value? No matter, anyway, use the property TextBox.Text
.
您可以使用XPath搜索来定位元素,如 ^ ].而不是将结果写入控制台(如示例中所示),而是将结果写入文本框.
You can locate an element using XPath search as shown here[^]. Instead of writing the result to Console (as shown in the example), write result to a text box.