Re: Question

>I would like to know if there is any mapping between the  "DOM tree" and
the XML file.

Just that "document order" in the XML file corresponds to a depth-first
tree-walk of the DOM. (With the exception of Attrs; the XML spec says they
are unordered and the DOM is not required to keep them in any particular
order.)

> What can I do to know the physical position of an XML content node in the
XML file?

If you mean line number and/or character offset -- the DOM doesn't define
any way to obtain that information. Some DOM implementations may have
custom features which can answer this question, but code using those
features will not be portable. Generally, XML assumes that nobody but the
parser cares about that level of detail; once the information has been read
into a DOM, you want to work in terms of its structure and information
content rather than exactly how it was written in the file.

If your question is "how can I generate useful error messages" -- the best
solution I've seen is to have your message include an XPath that indicates
where the error occurred.

______________________________________
Joe Kesselman  / IBM Research

Received on Thursday, 8 June 2000 14:12:13 UTC