xml - Getting all child names using xmlstarlet/xpath -
using xmlstarlet/xpath, how name of child elements of node? example, want child element names of /a
<a> <b><c/></b> <d/> </a>
should return:
b d
i tried
xmlstarlet sel -t -c 'name(/a/*)' -
but gives me b
i don't think xpath 1.0 expression can it, either need xpath 2.0 /a/*/name()
(which don't think xmlstarlet supports) or need use xslt or try use xmlstarlet command line options try mimic xslt. don't have access tool , not familiar details, according http://xmlstar.sourceforge.net/doc/xmlstarlet.txt try
xmlstarlet sel -t -m "/a/*" -v "name()"
untested.
Comments
Post a Comment