Getting child node names from xmlstarlet
cat <xml file>| xmlstarlet sel -t -m “//path/to/child::node()” -v “name()” -n
with XML like this:
<?xml version=”1.0″ encoding=”UTF-8″?><landshark_properties VERSION=”2.3.1″>
<general>
<stuff/>
</general>
<groups>
<vdb_groups>
<vdb_group>
<value>Dev Copies</value>
</vdb_group>
</vdb_groups>
<dsource_group>
<value>Sources</value>
<type>String</type>
<description>The ONE group Landshark setup will create for the dSources – No need to change</description>
</dsource_group>
</groups>
<environments>
<things/>
</environments>
<engine>
<morethings/>
</engine>
<content>
<sugarcrm/>
<employee_11/>
</content>
</landshark_properties>
Output like this:
cat text.xml | xmlstarlet sel -t -m “//content/child::node()” -v “name()” -n
sugarcrm
employee_11
Recent Comments