How do I extract from XML a tag including it's inner tags? PHP JAVASCRIPT and AJAX?

  • Thread starter Thread starter eliyahu_s
  • Start date Start date
E

eliyahu_s

Guest
I have an XML file
<aaa>

<question>
1
<br/>
1
<br/>
1
</question>

<answer>
2
<br/>
2
<br/>
2
</answer>
</aaa>
echoed by my php file with XML headings
Then in my Javascript file I have the function stateChanged() which includes:

document.getElementById("question").innerHTML=xmlDoc.getElementsByTagName("question")[0].childNodes[0].nodeValue;
document.getElementById("answer").innerHTML=xmlDoc.getElementsByTagName("answer")[0].childNodes[0].nodeValue;
But instead of getting:
<question>
1
<br/>
1
<br/>
1
</question>
I'm getting:
<question>
1
<br/>
Any ideas how to fix this?
 
Back
Top