shithub: xmltools

ref: fc012e4dcc216d33f07262e64e3417043a7aa564
dir: /README/

View raw version
XML tools

This package requires the updated libxml from 9atom and libxpath.
See also:
- https://shithub.us/sirjofri/xml-9atom/HEAD/info.html
- https://git.sr.ht/~sirjofri/xml-9atom


XQ: xml query

cat file.xml | xq '/path'
xq -f file.xml '/path'

path is an XPath (but not everything is supported).

Xq currently can handle some queries itself (without libxpath). To make use of these, you have to adjust the xq.c file to call 'query' instead of 'query2'. This is a leftover that will eventually be removed.

Limited XPath features (without libxpath):

- @attr: /hello/world/@attr
- text(): /hello/world/text()
- [@attr='value']: /hello/world[@attr='second']/stuff
- [2]: /hello/world[2]/stuff