ok ... let me try it ;)
assuming we have the following typical and simple xml-document:
-
<?xml version="1.0" standalone="no" ?>
-
<!DOCTYPE message SYSTEM "message.dtd">
-
<message>
-
<from>The Kenster</from>
-
<to>Silly Little Cowgirl</to>
-
<body>
-
Hi, there. How is your gardening going?
-
</body>
-
</message>
-
the first line says that we have a xml-document of version 1.0 and that this document is associated by a DTD (document type definition) that describes the structure of the document (which elements are valid, what elements may be contained by which elements, which of them must be contained, how often they have to be contained ... which attributes are mandatory etc.) ... it may also (should) have an encoding attribute.
the second line refers the mentioned DTD and the root-element 'message'.
then the interesting part now, often called the docs body or payload of the doc ... the one to parse :) you get the 'message'-node as an instance of a message with the childNodes from, to and body ... so you have the data for your message ... assuming you have multiple messages you probably would have a root-element called 'messagelist' that has to be specified in the DTD when having one ... note: the DTD is optional, but required if you want to validate your document against it ... so there is now a next point:
an xml-doc is well-formed if it is syntactically correct ...
an xm-doc is valid when it is validated against a DTD and correct in that way
'well-formedness' is required ... validity is not ...
so you may access the elements in the document with regular dom-methods ... for example:
-
var messages = document.getElementsByTagName('message');
-
-
for (var i in messages) {
-
// you may now access one message's childNodes with
-
// known methods, navigating through it with siblings etc.
-
}
-
may be the following links could help too:
http://www.w3schools.com/dom/default.asp
http://www.stylusstudio.com/docs/v60/d_xpath9.html
http://www.awprofessional.com/articles/article.asp?p=27006&seqNum=3&rl=1
the last one has a very good explaination ...
i hope it helps more ... and kind regards ...