W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2000

Re: Question

From: <keshlam@us.ibm.com>
Date: Thu, 8 Jun 2000 14:11:44 -0400
To: Tatiana Almeida Souza Coelho <tasc@dcc.ufmg.br>
cc: www-dom@w3.org
Message-ID: <852568F8.0063EEE8.00@D51MTA03.pok.ibm.com>
>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

> 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

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:07 UTC