Build small, higher‑level functions on top of what you already have, using the existing XPath C APIs.
“Typed” helpers:
doc.xpathNodes("//foo") : Array[Xml2Node] iso^?
doc.xpathString("string(//foo)") : String val?
doc.xpathNumber("count(//foo)") : F64?
doc.xpathBool("boolean(//foo)") : Bool?
These are just thin wrappers around your existing xpathEval and Xml2XPathObject.apply, but greatly clean up call sites.
Pre‑compilation: expose xmlXPathCompile / xmlXPathCompiledEval as a reusable compiled expression type if you find yourself evaluating the same XPath repeatedly.
Build small, higher‑level functions on top of what you already have, using the existing XPath C APIs.
“Typed” helpers:
doc.xpathNodes("//foo") : Array[Xml2Node] iso^?
doc.xpathString("string(//foo)") : String val?
doc.xpathNumber("count(//foo)") : F64?
doc.xpathBool("boolean(//foo)") : Bool?
These are just thin wrappers around your existing xpathEval and Xml2XPathObject.apply, but greatly clean up call sites.
Pre‑compilation: expose xmlXPathCompile / xmlXPathCompiledEval as a reusable compiled expression type if you find yourself evaluating the same XPath repeatedly.