- From: Sean Owen <srowen@google.com>
- Date: Wed, 20 Jun 2007 12:14:56 -0400
- To: public-mobileok-checker@w3.org
I suggest we go forward with this as a "good enough" solution for now. After days of digging there just doesn't seem to be a clean way to extract more than this out of a DOM. But I think this does enable fairly easy access to line numbers from the source in XSLT and Java, so we get fully half of what we wanted. Thoughts on this -- other approaches? On 6/20/07, Laura Holmes <holmes@google.com> wrote: > Hi all, > Here's the latest on line number info in Java: > > We've decided to implement a static method in DOMUtils that given any node > will return the line number of that node in the original document. To do > this, we're leveraging off of Saxon's DocumentBuilderFactoryImpl. When > certain properties of this class are set, the basic Node is wrapped with > information that includes the original line number. The subsequent method in > DOMUtils called getNodeLineNumber(Node node) basically unwraps this > information and returns the line number. > > This final implementation was decided upon after a few dead ends with Xerces > and Saxon's TinyTree. Both offer a class of ElementImpl (or variation of > that name) which contain a method called getLineNumber() and > getColumnNumber(). However, after trying to implement these methods > unsuccessfully, we learned that these methods were inherited from an > interface and had remained unimplemented. After some more searching, it > seems as if there are no other methods that we can use to get column number > without some intense hacking on our side by possibly wrapping the nodes > ourselves with this information. > > So, in the end, we have line number but no column number. I'm going to open > this up for input and get some thoughts. If no one has any objections, I'll > commit the changes soon. > > Cheers, > Laura
Received on Wednesday, 20 June 2007 16:15:09 UTC