[Mono-osx] Problem reading XML files:

Bart Masschelein masschel at gmail.com
Fri Jul 11 08:51:51 EDT 2008


(crawling away, with tail between legs...)

On 09 Jul 2008, at 11:04, Andreas Färber wrote:

> 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