XML.jl icon indicating copy to clipboard operation
XML.jl copied to clipboard

XPath support

Open tecosaur opened this issue 11 months ago • 1 comments

While XML.jl does a great job just with parsing/writing XML documents, it would be great if it provided a few facilities to help work with them too.

One that would be really nice to see is XPath support. I've implemented a simple subset of XPath as a macro in a package of mine:

https://code.tecosaur.net/tec/RestClient.jl/src/branch/main/ext/XMLExt.jl#L102

It works by producing an XPath-getting function from the macro, e.g.

julia> @macroexpand @xpath "some/xpath/@attr"
node -> extract_attr(extract_child(extract_child(node, "some"), "xpath"), "attr")

Perhaps that could be a useful starting point or at least of interest?

tecosaur avatar Dec 11 '24 02:12 tecosaur

Being able to get children/attributes via XPath support sounds good

stemann avatar Apr 27 '25 16:04 stemann