(Video materials in preparation)
xmlpath : Prints paths of XML
Usage : xmlpath [<xmlfile>]
Version : Tue Jan 9 09:02:34 JST 2024
Edition : 1
Prints paths of XML specified by <xmlfile>. Output is formatted like:
/tag-name
/tag-name/tag-name
/tag-name/tag-name/tag-name
...
/tag-name/tag-name..../tag-name
Empty lines, comments and DTD declaration will be removed.
Elements containg attributes will result in:
tag-name@attribute having an attribute
tag-name@{attribute,attribute,...} having over two atttributes
$ cat xml
<?xml aaa="aaa" bbb="bbb" ?>
<top/>
<!-- comment -->
<dir1 id1="0" id2="1">
<!-- comment -->
<dir2 id="a">
<!-- comment -->
<file attr="001">xxx</file>
<!-- comment -->
<file attr="002">yyy</file>
<file attr="003">zzz</file>
</dir2>
<dir2 id="b">
<file attr="004">XXX</file>
<file attr="005">YYY</file>
</dir2>
</dir1>
<last/>
$ xmlpath xml
/top
/dir1@{id1,id2}/dir2@id/file@attr
/dir1@{id1,id2}/dir2@id/file@attr
/dir1@{id1,id2}/dir2@id/file@attr
/dir1@{id1,id2}/dir2@id/file@attr
/dir1@{id1,id2}/dir2@id/file@attr
/last
A given XML document must hold a line for each start and end tag.