I have xml as under
<databaseserver>
<server name="server1" serverid="1">
<databases>
<database dbid="1" dbname="db1" />
<database dbid="2" dbname="db2" />
</databases>
</server>
<server name="server2" serverid="2">
<databases>
<database dbid="1" dbname="db1" />
<database dbid="2" dbname="db2" />
</databases>
</server>
<server name="server3" serverid="3">
<databases>
<database dbid="1" dbname="db1" />
<database dbid="2" dbname="db2" />
</databases>
</server>
</databaseserver>
I want to delete the nodes and it's subnodes whose serverid="1".
Final output will be
<databaseserver>
<server name="server2" serverid="2">
<databases>
<database dbid="1" dbname="db1" />
<database dbid="2" dbname="db2" />
</databases>
</server>
<server name="server3" serverid="3">
<databases>
<database dbid="1" dbname="db1" />
<database dbid="2" dbname="db2" />
</databases>
</server>
</databaseserver>
How can I do so?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…