Phat said:
Has anyone seen a great tutorial on how to use the dom to properly parse an
xml document? I was hoping to find something in depth that might show maybe
via a pictorial how child nodes and node data etc relates to an example xml
document.
If you write vour document in W3C xhtml 1.1 (which can be all xml, all
html, or a combination of both) and serve it properly using the mime
type application/xhtml+xml., then it is very easy to parse the document
as xml since the browser automatically does it for you. If you use a
recent Mozilla family browser(Firefox, Mozilla, Netscape) or Opera, the
document is parsed as xml rather than html. The least little xml error
will either prevent the page from displaying at all and/or give an xml
error message rather than a view of the page. Of course IE6 can not
handle true xhtml served with the mentioned mime type, so it does not
allow the page to be viewed. Use of a php include at the very top of
the page can automatically convert the page from xhtml 1.1 to html 4.1
strict for IE6 or older other browsers that can not used the mentioned
mime type for xhtml/xml pages.
Now if you are wanting to build your own parser, that likely will be
much more difficult. I have found no need to do so because of the
things discussed in the first paragraph. Building new browsers and
parts of them such as parsers are chores that very few people are
experienced enough to undertake.