Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > How DOMLocator operate?

Reply
Thread Tools

How DOMLocator operate?

 
 
Max
Guest
Posts: n/a
 
      10-13-2006
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
 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      10-13-2006
Max wrote:
> 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.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
 
 
 
Max
Guest
Posts: n/a
 
      10-14-2006
Joseph Kesselman ha scritto:
> Max wrote:
>> 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...


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM



Advertisments