I am parsing some XML using Nokogiri and XPath. When I do this:
doc.xpath('//Order/child::node()').each do |node|
puts node.name
end
It prints out all the nodes, but also in between names, it prints out ‘text’. I think I know why:
In my xml, there’s spaces between nodes like this : "<a1>hi</a1> \n <a2>bye</a2>"
Is there a way I can tell it to ignore stuff between nodes?
Use:
this selects all children nodes of any
Orderelement, except the ones that are text nodes consisting entirely of white-space.XSLT – based verification:
when this transformation is applied on the following XML document:
the two XPath expressions are evaluated and the nodes of two corresponding sets of selected nodes are output, each preceded by its position number: