I have a line that gets the nodeValue of a Node:
parent.getElementsByTagName("Url")[0].nodeValue
that returns nothing:
<br/>
When I do:
parent.getElementsByTagName("Url")[0].toxml()
it returns:
< Url>www.something.com< /Url>
I am not sure what is going on here. Another data point: when I do nodeName instead of nodeValue it returns, as expected, Url.
Any thoughts?
xml. dom. minidom is a minimal implementation of the Document Object Model interface, with an API similar to that in other languages.
The DOM is a standard tree representation for XML data. The Document Object Model is being defined by the W3C in stages, or “levels” in their terminology. The Python mapping of the API is substantially based on the DOM Level 2 recommendation. DOM applications typically start by parsing some XML into a DOM.
toprettyxml. n.toprettyxml(indent='\t',newl='\n') Returns a string, plain or Unicode, with the XML source for the subtree rooted at n, using indent to indent nested tags and newl to end lines. toxml. n.toxml( )
Try this:
parent.getElementsByTagName('Url')[0].childNodes[0].nodeValue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With