SV: [jdom-interest] Line numbers

Per Norrman pernorrman at telia.com
Tue Aug 26 01:48:52 PDT 2003


Hi,

SAX provides the  Locator interface, which is an optional
thing for parsers to implement. 

Sometimes, I just have to solve things like this. I 
subclassed DefaultJDOMFactory and Element, as well as
SAXBuilder and SAXHandler. There may be a more elegant
way....

I've attached some code and a test data file.

/pmn

> -----Ursprungligt meddelande-----
> Från: jdom-interest-admin at jdom.org 
> [mailto:jdom-interest-admin at jdom.org] För Paul Cantrell
> Skickat: den 26 augusti 2003 02:38
> Till: jdom-interest at jdom.org
> Ämne: [jdom-interest] Line numbers
> 
> 
> A question that I'm sure you're sick of hearing, but I didn't 
> see it in 
> the FAQ:
> 
> Is it possible for me to trace a parsed element back to the 
> line number 
> on which it appeared in the XML source?  Probably this information is 
> thrown away before it even gets to JDOM, but if there's any 
> way to get 
> at it, it sure would be nice.....
> 
> Cheers,
> 
> Paul
> http://innig.net
> 
> _______________________________________________
> To control your jdom-interest membership: 
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: data.xml
Type: text/xml
Size: 74 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20030826/7c08af8f/data.xml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LineTest.java
Type: application/octet-stream
Size: 2375 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20030826/7c08af8f/LineTest.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: JDOMTreeWalker.java
Type: application/octet-stream
Size: 3222 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20030826/7c08af8f/JDOMTreeWalker.obj


More information about the jdom-interest mailing list