I'm going to be writing a program which has some web services in it that use XML to pass data back and forth. The format of the XML is predefined - I can't change it to suit my needs - but in code I can handle the data any way I want.
My question: Is it better for me to handle the data structure in code as an XML tree, or to write an equivalent data structure as an object in the language along with some utility functions for conversion to and from the XML?
I have some thoughts on the issue myself, but I don't want to unintentionally bias anyone's answers. This is a language-agnostic question, but if there's any language considerations you have I'd like to hear it.
Edit: To clarify, the XML format itself is setup in a logical manner. The object in the language wouldn't differ much from it. For example, it might look something like this (this is a poor example, but you get the gist I hope):
<car>
<make>DATA</make>
<model>DATA</model>
<ownershipDates>
<startDate>DATA</startDate>
<endDate>DATA</endDate>
</ownershipDates>
</car>