- Home /
Error parsing XML string with attributes usign XMLDocument when built on WebGL
public class SpikeTest : MonoBehaviour
{
public const string DefaultString1 =
@"<NodeOne><NodeTwo/></NodeOne>";
public const string DefaultString2 =
@"<NodeOne><NodeTwo attr='hello'/></NodeOne>";
// Use this for initialization
void Start ()
{
using(var responseReader = new StringReader(DefaultString1))
{
using(var xmlReader = new XmlTextReader(responseReader))
{
var xmlOutcome = new XmlDocument();
xmlOutcome.Load(xmlReader);
var item = xmlOutcome.GetElementsByTagName("NodeTwo");
Debug.Log("NodeTwo first: " + item[0].LocalName);
}
}
using(var responseReader = new StringReader(DefaultString2))
{
using(var xmlReader = new XmlTextReader(responseReader))
{
var xmlOutcome = new XmlDocument();
//Fails here.
xmlOutcome.Load(xmlReader);
var item = xmlOutcome.GetElementsByTagName("NodeTwo");
Debug.Log("NodeTwo second: " + item[0].LocalName);
}
}
}
}
The above code fails when it tries to parse "DefaultString2". Note how "DefualtString2" has an attribute compared to "DefaultString1". This happens when I build the game on the WebGL platform with no exceptions. Enabling exceptions in the build does not throw the error or catch any either. We need the game to run with all the exception flags.
Note: The exception thrown is "A exception has occured, but exception handling has been disabled in this build..." As I mentioned before Enabling exceptions does not help as the exception is not thrown in the latter case.
Seems to be a known bug. Haven't found anything new on that topic.
btw, why did you post the same issue twice? From the edit date / time i can see that your posts were about 17h in the moderation queue.
I couldn't find my question anywhere so I thought it didn't go through the first time. Sorry for that.
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
WebGL XML parsing error "InvalidOperationException" 0 Answers
WebGl Xml parsing probrem 0 Answers
XML Serialization not working on WebGL 0 Answers