You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Ritu Raj Tiwari <ri...@yahoo.com> on 2005/02/25 23:03:54 UTC
Locator does not point to start of element
When startElement() is called on my Handler, the
document locator does not actually point to the start
of the element, but to the position *past* the element
start. E.g. consider the following XML fragment:
<tag attrib1="value1" attrib2="value2>
.
.
.
</tag>
In
<tag attrib1="value1" attrib2="value2>
^ ^
Expected locator Actual locator
The actual locator at statElement() is one column past
the end of element start. Is there a way to get the
locator to point to the real start of the element?
Thanks.
-Raj
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Locator does not point to start of element
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Raj,
The locator in Xerces is actually the scanner. It always points to the
scanner's position in the stream. This is consistent with SAX says which
says that the column [1] and line [2] numbers reported by the locator
correspond to the position where "the current document event ends".
There's no way to configure the parser so that the Locator points
elsewhere.
[1]
http://www.saxproject.org/apidoc/org/xml/sax/Locator.html#getColumnNumber()
[2]
http://www.saxproject.org/apidoc/org/xml/sax/Locator.html#getLineNumber()
Ritu Raj Tiwari <ri...@yahoo.com> wrote on 02/25/2005 05:03:54
PM:
> When startElement() is called on my Handler, the
> document locator does not actually point to the start
> of the element, but to the position *past* the element
> start. E.g. consider the following XML fragment:
>
> <tag attrib1="value1" attrib2="value2>
> .
> .
> .
> </tag>
>
> In
> <tag attrib1="value1" attrib2="value2>
> ^ ^
> Expected locator Actual locator
>
> The actual locator at statElement() is one column past
> the end of element start. Is there a way to get the
> locator to point to the real start of the element?
>
> Thanks.
> -Raj
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org