in reply to Data Structure Advice

A couple of thoughts. First off, you said you want to generate XML, but you should be aware that the example you give is pretty far from being legal XML. XML is case-sensitive; values must be associated with attributes, not the base tags; and attribute values must be contained in quotes. In other words, your XML should probably look more like this:
<IPClassA id = "1"> <Device id = "1"> </Device> </IPClassA>
(Actually, for empty elements you can combine the opening and closing tags as in <Device id = "1" />, but that's not particularly important here.)

Anyway, the comments in this node may point you in the right direction.