It often happens that you want to group discovered hosts by function, location, or some other principle. Creating a top-level node for a group and and moving the host nodes under is an intuitive way to do it.
<group>servers
<host>192.168.1.1</host>
<host>192.168.1.2</host>
</group> <group>others
<host>10.0.0.1</host>
</group>
However this will break subsequesnt data merges. New data for any particular host will be merged on top level, rather then at the location where you have moved it.
More workable approach is to put a group label under the host node:
<testdata>
<host>192.168.1.1
<group>servers</group>
</host>
<host>192.168.1.2
<group>servers</group>
</host>
<host>10.0.0.1
<group>others</group>
</host>
</testdata>
This way you can select the nodes in a particular group ("servers" in this example) using the following XPath expression:
//host[group='servers']
Adding a "group" node to multiple hosts is easy. Create a "group" node under one of the hosts. Copy it using Ctrl+c (Command+c on Mac). Select all the hosts you want to add to the group. Press Ctrl+v (Command+v on Mac) to paste the "group" node under all selected hosts.