I am very new to C#. I have XML file (text.xml). I want to read that in XmlDocument
and store the stream in string variable.
相关问题
- Sorting 3 numbers without branching [closed]
- Illegal to have multiple roots (start tag in epilo
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
If your .NET version is newer than 3.0 you can try using
System.Xml.Linq.XDocument
instead ofXmlDocument
. It is easier to process data withXDocument
.Use
XmlDocument.Load()
method to load XML from your file. Then useXmlDocument.InnerXml
property to get XML string.Hope you dont mind Xml.Linq and .net3.5+
Depending on what you are interested in, you can probably skip the whole 'string' var part and just use XLinq objects