How should one proceed to load XML content from a javascript script in cocos2d-x 3.0?
I need to parse an XML file but DOMParser
is unavailable:
var text="<note>";
text=text+"<content>whatever blablabla</content>";
text=text+"</note>";
var parser=new DOMParser();
var doc=parser.parseFromString(text,'text/xml');
results in ReferenceError: DOMParser is not defined
.
How should I proceed to load and manipulate the XML?
Even this solution fails:
var doc = document.implementation.createDocument("");
ReferenceError: document is not defined
.
From the V2.2.1 documentation I tried the SAXParser to no avail:
cc.SAXParser.getInstance().parse(fullPath);
TypeError: cc.SAXParser is undefined
To paliate to the removal of cc.SAXParser
in cocos2d-x 3.0 the solution is to use a pure javascript parser until a better solution is made available.