[Mono-osx] Problem reading XML files:
Andreas Färber
andreas.faerber at web.de
Wed Jul 9 05:04:23 EDT 2008
Hi Bart,
Am 08.07.2008 um 23:01 schrieb Bart Masschelein:
> I encountered a small issue, reading an XML file. I use
> the following code, where xmlFile is a string to the xml file:
>
> XmlDocument doc = new XmlDocument();
> // Works
> XmlTextReader reader = new XmlTextReader(xmlFile);
> doc.Load(reader);
> // Does not work in Mono
> //doc.LoadXml(xmlFile);
>
> As you can see in comments, doc.LoadXML(xlmFile) fails, reporting:
>
> Unhandled Exception: System.Xml.XmlException: Text node cannot appear
> in this state. Line 1, position 1.
LoadXml accepts a string containing the XML, not a file name. You
probably want Load(xmlFile) instead.
HTH,
Andreas
More information about the Mono-osx
mailing list