开发者

No XML readers work!

开发者 https://www.devze.com 2023-02-13 07:54 出处:网络
I\'m trying to read an XML file with my C# application. I\'ve tried many things and every time I try to use XmlReader or Xm开发者_如何学ClTextReader, nothing works. It simply doesn\'t recognize any fu

I'm trying to read an XML file with my C# application. I've tried many things and every time I try to use XmlReader or Xm开发者_如何学ClTextReader, nothing works. It simply doesn't recognize any functions from the object I just created. I've tried the following with both XmlReader and XmlText Reader:

XmlReader reader = new XmlReader();

OR

XmlReader reader = XmlReader.Create(path);

When I try to use reader.Read() it simply returns an error acting like reader doesn't exist. I'm a bit out of options as I don't understand XPath and these are what's left when it comes to reading XML as far as I understand it.


Did you add the namespace at the top of your source file?

using System.Xml;


XmlReader is an abstract class. Try XmlTextReader instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消