Check XML file for a given structure and edit it in case

Hey guys,

So I’ve an XML file for my Maps and stuff (using tiled).
I have this attribute in my XML File:

 <objectgroup name="objectLayer">
<!--- blabla --->
 </objectgroup>

Unfortunately Tiled is not generating this .XML file in the right format to be handled by my map creation process.
I need to add an ID and a height and width to this attribute, so the desired outcome would be:

 <objectgroup id="0" height="32" width="32" name="objectLayer">
<!--- blabla --->
 </objectgroup>

What would be the best way to first check whether the .XML attribute is correct and in case it’s not adding these three values to it?
I know there are some .XML libraries like SAX OR DOM but I’m not quite sure which one to take or whether these frameworks might be a little bit of overkill for my task.

Thanks!