Html tags inside xml tags - how to access javascript?

I pass my xml data through php where all xml nodes contain 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 easy to access the declaration and declaration, but it always prints zero for node ad code

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 javascript code above is used for access, please help me access html tags using xml node ....

+3
source share
1 answer

You must compete with the xml node with the CDATA block as follows:

<ad-code><![CDATA[<u><b>C Language</b></u>]]></ad-code>
+4
source

Source: https://habr.com/ru/post/1765277/


All Articles