Most people think to the physical structure of the XML document when working on it and assume that it will be the same when parsed into the memory.
However, when we are working with an XML document, we are not working with the physical XML element.
Thus, the XML document:
<person> <lastname></lastname> <fistname></fistname> <phone></phone> <email></email> <address> <street></street> <city> </city> <state></state> <zip></zip> </address> <person>
is assumed to be like this in the memory:
but it might be different.
When there is no DTD or XML Schema attached to the XML document, indeed it will be the same.
But when there is an DTD or XML Schema attached, the XML tree in memory might look like different.
By example, if there is a default attribute “number” is defined for street, the tree will contain
an attribute named “named” on the street element.
In the first case /person/address/street/@number does not exists !
Your XPath queries might function differently depending on these details.