How DOMLocator operate?

Discussion in 'XML' started by Max, Oct 13, 2006.

  1. Max

    Max Guest

    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
     
    Max, Oct 13, 2006
    #1
    1. Advertising

  2. 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
     
    Joseph Kesselman, Oct 13, 2006
    #2
    1. Advertising

  3. Max

    Max Guest

    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
     
    Max, Oct 14, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. benn
    Replies:
    2
    Views:
    617
  2. Maya Young

    Use C# to operate a mobile device

    Maya Young, Apr 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    635
    Maya Young
    Apr 17, 2004
  3. Dux
    Replies:
    1
    Views:
    294
    Mike Wahler
    Oct 5, 2003
  4. Timothy Madden

    How does #define operate ?

    Timothy Madden, Sep 27, 2004, in forum: C++
    Replies:
    5
    Views:
    642
    Xenos
    Sep 28, 2004
  5. Richard Cavell

    GMP: Cannot operate on vector<mpz_t>

    Richard Cavell, Feb 18, 2005, in forum: C++
    Replies:
    3
    Views:
    1,165
    Richard Cavell
    Feb 18, 2005
Loading...

Share This Page