Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript parse xml

const txt = "<address> <street>Roble Ave</street> <mtfcc>S1400</mtfcc> </address>"

if (window.DOMParser){
    parser = new DOMParser();
    xmlDoc = parser.parseFromString(txt, "text/xml")
}
else // Internet Explorer
{
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async = false;
    xmlDoc.loadXML(txt);
}
 
PREVIOUS NEXT
Tagged: #javascript #parse #xml
ADD COMMENT
Topic
Name
3+2 =