Here is a list of countries in XML format:
<countries>
<country>
<code>CA</code>
<name>Canada</name>
</country>
... etc...
</countries>
I am looking to extract and loop through these nodes, so I use the following XPath expression:
path "/countries/*"
Then in my JavaScript code:
nodes = xml.evaluate(path, xml, null, XPathResult.ANY_TYPE, null);
However, when iterating through the nodes, I notice that there are whitespace nodes at positions 1 and 3, while the actual country information is at positions 2 and 4.
How can I modify my XPath query to skip over the whitespace-only nodes and only focus on the parts with actual XML content? It's important for me to exclude any potential line feeds present in the XML data.