I’m using this to use a XML document
_getXmlDocument: function(TextToParse) {
try {
//XmlDoc = new ActiveXObject("Microsoft.XMLDOM")
var XmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
XmlDoc.async = "false"
XmlDoc.loadXML(TextToParse);
}
catch(ex) {
Efficy.log("_getXmlDocument - Cannot create an XML document: " + ex.description)
//Firefox, Mozilla, Opera, etc.
try {
Parser = new DOMParser()
XmlDoc = Parser.parseFromString(TextToParse,"text/xml")
}
catch(ex) {throw new Error("Cannot create an XML document: " + ex.description)}
}
return XmlDoc
}
I would like to after getting a specific tag
privates._XmlGetElementsByTagName(data, "tagname")
to simply export the raw XML including the XML tags in a string.
But I cannot find a way to do this
I tried looping etc but no results
2
Answers
Use XMLSerializer to change it back into a string.
You can serialize a specific DOM node to XML.
For node.js you can use @xmldom/xmldom.