Log DOM representation of XML in firebug?

I am trying to send an XML node to a firebug console and when calling something like

console.log(myXML); 

I see something like below in the output panel:

 constructor XML Document {} 
Expansion

leads me to a list of XML DOM methods, etc., and not to the document itself. I was hoping there was a way to trace the DOM node view, similar to when you call console.log on an html element. Am I doing something wrong or is it impossible?

Thanks,

+4
source share
1 answer

This works with XML elements, not the document itself. Try the following:

 var parser = new DOMParser(); var doc = parser.parseFromString("<test></test>", "text/xml"); console.log(doc.firstChild); 

To print an outline from a document element, use the following:

 console.dirxml(doc) 
+2
source

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


All Articles