thebick
5 years agoOccasional Contributor
SelectSingleNode not finding XML nodes; trying to setProperty("SelectionNamespaces", ...)
I am trying to use SelectSingleNode() to find any node other than the root for this XML: <?xml version="1.0?>
<myRootNode xmlns:xsl="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http:...
- 5 years ago
Finally figured out how the SelectionNamespaces stuff works:
doc.setProperty("SelectionNamespaces", "xmlns:<your_abbreviation>=<your_namespace>"
which can then be used as
nodeToFind = parentNode.SelectSingleNode("<your_abbreviation>:<tag1>/<your_abbreviation>:<tag2>")
I need "<your_abbreviation>:" at all levels, because the namespace is at the root. In my case
doc.setProperty('SelectionNamespaces', 'xmlns:abbrev="my:set:of:coloned:stuff"') L3N1 = root.SelectSingleNode("abbrev:level1Node1")
works, adding "abbrev" and dropping the leading "/"