xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: "Frankpeter Lohse" <frape AT frapelo.de>
- To: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] location of elements?
- Date: Tue, 31 May 2005 09:44:56 +0200
On Mon, 30 May 2005 18:16:20 +0200, Michael Kay <mike AT saxonica.com> wrote:
With respect, those are not very good reasons. SAX parsers already provide
the information, and it can be delivered over the API by a single method
getLocation() with a corresponding return class. The implementation of
course is a bit complicated because you have to store the information "out
of band" so there is zero overhead for people who don't need it.
My suggestion is:
add a new method to nu.xom.NodeFactory
Element startMakingElement(String name, String namespace, org.sax.Locator locator) {
return startMakingElement(name, namespace);
}
and use that method in XOMHandler's startElement method to create the element:
element = factory.startMakingElement(qualifiedName, namespaceURI, this.locator);
I could then subclass the NodeFactory, overwrite the new startMakingElement() method and create my own Element subclass that store the locator.getLineNumber and locator.getColumnNumber.
I don't know if it works and don't oversee the consequences for XOM, but it seems simple, backward compatible, optional at a first glance. What do you think?
And I wouldn't care too much if the line/col info is not accurate. To give the user just a hint in a multi 1000 line XML, where he can find the problem is always helpful.
Frape
-
[XOM-interest] location of elements?,
Frankpeter Lohse, 05/30/2005
-
Re: [XOM-interest] location of elements?,
Elliotte Harold, 05/30/2005
- RE: [XOM-interest] location of elements?, Michael Kay, 05/30/2005
- <Possible follow-up(s)>
-
Re: [XOM-interest] location of elements?,
Elliotte Harold, 05/30/2005
- RE: [XOM-interest] location of elements?, Michael Kay, 05/30/2005
- Re: [XOM-interest] location of elements?, Frankpeter Lohse, 05/31/2005
-
Re: [XOM-interest] location of elements?,
Elliotte Harold, 05/30/2005
Archive powered by MHonArc 2.6.24.