javascript parse xml

Solutions on MaxInterview for javascript parse xml by the best coders in the world

showing results for - "javascript parse xml"
Tom
26 Oct 2017
1const txt = "<address> <street>Roble Ave</street> <mtfcc>S1400</mtfcc> </address>"
2
3if (window.DOMParser){
4    parser = new DOMParser();
5    xmlDoc = parser.parseFromString(txt, "text/xml")
6}
7else // Internet Explorer
8{
9    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
10    xmlDoc.async = false;
11    xmlDoc.loadXML(txt);
12}