SV: [jdom-interest] Line numbers

Paul Cantrell cantrell at pobox.com
Tue Aug 26 12:33:04 PDT 2003


A reasonable response, Jason -- I could hardly care less about 4 bytes,  
but others may not be working under constaints as forgiving as mine.

Still, this seems like a problem of general interest with a general  
solution.  Perhaps JDOM could include this as an optional feature --  
you could pass an option to SAXBuilder, and it would create a subclass  
of Element with the additional information.  That gives casual users  
like me something to use without compromising things for  
resource-sensitive users. Per's code looks like a fine starting point  
for that.

Cheers,

Paul

On Tuesday, August 26, 2003, at 02:14  PM, Jason Hunter wrote:

> It's an idea that's been thrown out periodically.  You can see in the  
> TODO.txt a reference to this ides and a URL to a post from October  
> 2000.  The problem is it increases the required memory by 4 bytes per  
> element and probably slows the build somewhat.  Is it worth it?   
> Perhaps to some, perhaps not to others.  We've used this feature as an  
> example of what someone should be able to add to JDOM using  
> inheritance if JDOM's designed well.
>
> -jh-
>
> Paul Cantrell wrote:
>
>> Per --
>> This looks excellent.  Thank you very much!  I doubt I ever would  
>> have figured that out on my own!  I'll give it a try later today.
>> To the JDOM developers: This seems like it would be a really useful  
>> feature for JDOM to support, and it looks like something you could do  
>> fairly generically, without compromising JDOM's design.  If you have  
>> a feature request tracking system, well, consider this a request.
>> Cheets,
>> Paul
>> On Tuesday, August 26, 2003, at 03:48  AM, Per Norrman wrote:
>>> 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/ 
>> youraddr at yourhost.com
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/ 
> youraddr at yourhost.com
>




More information about the jdom-interest mailing list