I’m trying to load a large xml file in for parsing from www.text, but the usual xml.LoadXml() does not work…
I’ve also tried:
var stringReader:StringReader = new StringReader(w.text);
stringReader.Read(); // skip BOM
xml.LoadXml(stringReader.ReadToEnd());
I still get the following error:
XmlException: Text node cannot appear in this state. Line 1, position 1. Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace) Mono.Xml2.XmlTextReader.ReadContent () Mono.Xml2.XmlTextReader.Read () System.Xml.XmlTextReader.Read () System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) System.Xml.XmlDocument.LoadXml (System.String xml) gniptwitter+$fetchTweets$42+$.MoveNext () (at /gniptwitter.js:35)
The data file is from an api so I can’t change its format. However, it is valid XML. It might be UTF8 or some odd encoding that’s causing Unity to balk at XML-parsing it…
Does it actual have a Byte Order Marker? I'd start by not doing that extra read.
– Wazi actually tried it straight on with loadXML without that .read ... but errors galore. google'd around, found that the .read worked for some, but apparently not here :-\
– ina