XML Document in file and in memory

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:


<city> </city>


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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s