Xml getelementbyid to cclabel

Xml getelementbyid to cclabel
0.0 0


Hi im a newbie un cc2d-x html5, so im having a bit of a trouble here.

basically i need to get the value of a string with an id in an xml file and display it as cocos2d label.

so im using this parser.

parseXml: function(){

if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
{// code for IE6, IE5
xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);

this.quizElements = xmlDoc.getElementById(“TEXT_CLIP_1_2_01”);

} @

which is pretty ok, it shows in the log the specific line that the id belongs too.

then i tried using it as cocos2d label like this.

@ chatLabelFunc: function (){

this.chatLabel = cc.LabelTTF.create(this.quizElements,“Arial”, 32, 50, 50) ;
this.chatLabel.setPosition(cc.p(410, 100));
this.addChild(this.chatLabel, this.getZOrdering(9999, 99999));


but the label displays [object Element] rather than the actual string
here is where the xml file by the way

<?xml version="1.0" encoding="ISO-8859-1"?> <root> <String id="TEXT_CLIP_1_2_01">Will you join us for a healthy home-cooked meal?</String> </root>



I think the “this.quizElements” is a DOM element, it’s not a string. You can use innerHTML/innerText to get the content.