A
arthuryeung198
Hello all,
I have got an XML looks like the following. How can I use an XPATH
command to select //hostname and //instance? If there is no instance in
the sever, just skip, so it returns
<hostname>Host A</hostname>
<instance name="TOM" port="12345"/>
<instance name="TOM1" port="12346"/>
<hostname>Host B</hostname>
<hostname>Host C</hostname>
<instance name="TOM2" port="12345"/>
<instance name="TOM3" port="12346"/>
Basically, I want to select all the hostname, and certain field in the
<server> block.
Thanks!
=============
<?xml version="1.0" encoding="UTF-8"?>
<servers>
<server>
<record_info>
<lastchecked>20050316</lastchecked>
<hostname>Host A</hostname>
</record_info>
<components>
<instance name="TOM" port="12345"/>
<instance name="TOM1" port="12346"/>
</components>
<supp_info>
<contact name="TOM" email=""/>
<contact name="MARY" email=""/>
</supp_info>
</server>
<server>
......
</server>
<server>
......
</server>
</servers>
=============
I have got an XML looks like the following. How can I use an XPATH
command to select //hostname and //instance? If there is no instance in
the sever, just skip, so it returns
<hostname>Host A</hostname>
<instance name="TOM" port="12345"/>
<instance name="TOM1" port="12346"/>
<hostname>Host B</hostname>
<hostname>Host C</hostname>
<instance name="TOM2" port="12345"/>
<instance name="TOM3" port="12346"/>
Basically, I want to select all the hostname, and certain field in the
<server> block.
Thanks!
=============
<?xml version="1.0" encoding="UTF-8"?>
<servers>
<server>
<record_info>
<lastchecked>20050316</lastchecked>
<hostname>Host A</hostname>
</record_info>
<components>
<instance name="TOM" port="12345"/>
<instance name="TOM1" port="12346"/>
</components>
<supp_info>
<contact name="TOM" email=""/>
<contact name="MARY" email=""/>
</supp_info>
</server>
<server>
......
</server>
<server>
......
</server>
</servers>
=============