|
I can load a comma deliminated version of my xml data into my class fine, but in order to make it cleaner I wanted to output the data from my server in xml format and then load it in unity. In none xml format, I use WWW.text and then parse it. so Im assuming that to get xml from the web I would use the same thing. I can also load an xml file fine using the following code: However getting an xml schema from www.text and then deserializing it has not worked for me. Ive tried multiple derivative of the above code. Could some one aid me in collecting xml from www.text? the output from my server is standard xml format. EDIT: Here is a slightly modified version that has given me the most luck. It seems it is loading the xml file because an exception isnt thrown in my catch block, although the class values its supposed to populate are still showing up null. Again, when i use the version that loads from files it works perfectly.
(comments are locked)
|
|
The issue ended up being a problem with uppercase and lower case. But this peice of code is what exposed it almost immediately. Using xmlserializers event handlers, I was able to nail down the problem: And then insert this into the xml string serializer from above: serializer.UnknownElement+=new XmlElementEventHandler(Serializer_UnknownElement);
(comments are locked)
|
|
Its possible www.text sometimes comes with some unwanted characters. Try using replace in the www.text, one that has always got me is the indent character, try: string cleanedResponse = www.text.Replace("\t", ""); I incorporated that into the code, still doesnt seem to be working, although I like having it in there as a way to protect it from those errors in the future. I really think that Its that i dont have the xml deserializer coded properly to handle a string. The version I have working handles files fine though.
Aug 30 '12 at 01:49 AM
MichaelTaylor3d
(comments are locked)
|
