views:

28

answers:

1

I'm passing my xml data through php where all xml nodes are contains html tags

<bccfalna-ad>
<ad-id>99</ad-id>
<ad-title>New Ad</ad-title>
<ad-code><u><b>C Language</b></u></ad-code>

when i access this code in javascript, its easily access ad-id and ad-title but it always print null for ad-code node

var edit_ad_id = xmlDoc.getElementsByTagName("ad-id")[0].childNodes[0].nodeValue;
var edit_ad_title = xmlDoc.getElementsByTagName("ad-title")[0].childNodes[0].nodeValue;
var edit_ad_code = xmlDoc.getElementsByTagName("ad-code")[0].childNodes[0].innerHTML;

this above javascript code is used to access please help me to access html tags withing xml node....

A: 

You should wrap the contend of your xml node with a CDATA block like this:

<ad-code><![CDATA[<u><b>C Language</b></u>]]></ad-code>
Matteo Mosca
thanks this is working code.
tanujdave
Happy to have helped you. Remember to mark as anwser the post that helped you.
Matteo Mosca