How DOMLocator operate?

M

Max

Hello!

I would want to understand the operation of DOMLocator. In practical,
the coordinates (column and line number) of a DOMError (recovered by
inner implementation) only can be calculated during the parsing (on the
document originally formatted)? If i add a node to document (or any
other operation that modify the structure of the document), is it
impossible to recover the coordinates?

Max
 
J

Joseph Kesselman

Max said:
I would want to understand the operation of DOMLocator.

Information stored during parsing, referring to the original document
contents. No, it isn't maintained during DOM manipulations, not least
because the DOM doesn't know how the document is going to be serialized
back out (different serializers may generate different-but-equivalent
results) and so has no way to tell you what line something will be on in
the future.

I recommend very strongly against trying to express XML locations in
terms of line and column number. Generate an XPath to that location instead.
 
M

Max

Joseph Kesselman ha scritto:
Information stored during parsing, referring to the original document
contents. No, it isn't maintained during DOM manipulations...

Good! In this case, since DOMLocator is connected to DOMError, when is
DOMError used?

I recommend very strongly against trying to express XML locations in
terms of line and column number. Generate an XPath to that location
instead.

I think XML Locations must be in terms of line and column number! It's
most simple! You recommend to use XPath instead of line and column
number, but DOMLocator cannot have this format.
Is DOMLocator Uri the document Uri?
How to define UTF16 and Byte offset?

More thanks,

Max
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top