OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] SAX Locator vs {start,end}Entity

[ Lists Home | Date Index | Thread Index ]

On Thu, 20 Feb 2003, Richard Tobin wrote:

> >> Xerces seems to disagree: it returns the entity whose start or end is
> >> being reported.  So I guess one can't rely on it.
> >I think that is what Gregory meant.
> He said "the entity in which the reference was encountered", which I
> took to mean the entity containing "&ent;", rather than the entity ent
> refers to.
> Gregory, can you clarify?

Here is how I have implemented the SAX 2.0 Locator interface:

Entity being parsed    Event                Sysid reported by locator
-------------------    -----------------    ------------------------
Document               startElement         Document
Document               startEntity Foo      Document
Foo                    startElement         Foo
Foo                    endElement           Foo
Document               entEntity Foo        Document

At the startEntity and endEntity events, the locator also reports the line
and column numbers of the entity reference in the source document. My main
concern was error reporting: if an error occurs at or about an entity
reference, I wanted the locator to aid in troubleshooting.

If you have the locator return the system identifier of the
referenced entity, what would the line and column numbers be? 0 and 0?

Note though that a similar problem occurs with startDocument() and
endDocument(), in that it isn't clear what are the line number and column
number of such a "threshold event."

// Gregory Murphy <Gregory.Murphy@sun.com>


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS