Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Location-aware Elements

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Michael Kay <mike AT saxonica.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Location-aware Elements
  • Date: Sun, 08 Jan 2012 17:14:05 +0000

On 08/01/2012 01:53, Elliotte Rusty Harold wrote:
On Sat, Jan 7, 2012 at 2:48 PM, Olivier Lefevre<lefevrol AT yahoo.com> wrote:
I'd like to have location information in the final Document.
This is necessary if you are going to do post-processing and
maybe throw your own errors. Someone enquired in 2005 about
this and was rebuffed. Has anything changed since? How would
one go about doing this today? I don't care if that requires
me to write a custom NodeFactory.
What location information do you want? Line number and column number?
If so that's not really possible. SAX does not reliably provide that
to XOM.

I can think of good reasons for saying 'no' to this request, but this isn't one of them. Saxon has been using the position information provided by SAX parsers for years (for reporting the location of errors in stylesheets and validation errors in instance documents). It's generally very reliable. One can complain that it's not fine-grained enough, but it's perfectly adequate for this kind of purpose (you get the position of the '>' at the end of the start tag of every element).

Michael Kay
Saxonica




Archive powered by MHonArc 2.6.24.

Top of Page