2021年1月2日星期六

XPath 'or' operator using the 'pipe' character?

Within an AutoHotKey routine I'm using MSXML6 to parse an XML document.

doc := ComObjCreate("MSXML2.DOMDocument.6.0")  doc.setProperty("SelectionLanguage", "XPath")  doc.async := false  doc.loadXML(xmldata)  doc.selectNodes("osm/way|rel[tag[@k='railway'][@v='station']]").length  

In the SelectNodes line I wish to filter the results to only two nodes: way|rel

It doesn't throw an error but ignores rel returning only way nodes.

This syntax works when using it in Saxon. Is there a solution to this in MSXML, or is there an alternative parser I could implement?

https://stackoverflow.com/questions/65544668/xpath-or-operator-using-the-pipe-character January 03, 2021 at 06:17AM

没有评论:

发表评论