Does anyone know if there is a preferred way to read XML data into Cocos2D-HTML5
Looking at what the internals of the framework does to read the plist and TMX files, I’ve written this code, but it seems strange that there is not a generic way to at least load a xml file into the framework.
Does anyone know if there is some sort of XML loader / parser built into the framework (that I’ve not spotted ).
var arr=new Array();
var parser = cc.SAXParser.getInstance();
var textxml = parser.getList("res/content.xml");
// get a reference to the requested corresponding xml file
var dom_parser = new DOMParser();
xmlDoc = dom_parser.parseFromString(textxml, "text/xml");
else // Internet Explorer (untested!)
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
var quizElements = x=xmlDoc.getElementsByTagName("quiz");