SV: [jdom-interest] Line numbers

Jason Hunter jhunter at servlets.com
Wed Aug 27 01:56:08 PDT 2003


Hi Phill,

We have a jdom-contrib module explicitly designed for things that aren't 
really proper in the core but are cool in support of JDOM.  You can 
check it out via CVS and it's available as jdom-contrib-b9 in the 
distribution directories.  I added that early on because I agree with 
you there's lots of good extensions to every product that don't always 
belong in the product itself.

-jh-

Phill_Perryman at Mitel.COM wrote:

> I have been reading the mailing list and have seen a few requests like this
> come along and the general answer has always been no.
> 
> I have always agreed that JDOM should be small, efficient and cover the
> basics so users can extend for specific purposes.
> 
> I think however that we are also missing an opportunity to develop
> extensions to JDOM which would be useful to a lot of people some of the
> time so could the JDOM group support some JDOM extensions outside to the
> jdom.jar file but within the jdom cvs and documented at jdom.org so people
> know what is there.
> 
> Is there a JDOM contribution system where users can contribute specific
> extensions and factory methods, I think if I went to the site and there was
> a pre-built LineNumberElement class available which does line number
> checking and maybe a FriendlyElement class which does getIntAttribute,
> getDoubleAttribute, getDateAttribute, etc.  I would use them sometime and
> it would make my life easier and JDOM richer.  For instance I have just
> written a factory method that returns a JTree given an element and an
> attribute name where each item in the tree represents a child element with
> the text given by the attribute.
> 
> If the mailing list supported such things then they could be added into the
> JDOM environment without disrupting the core JDOM system.
> 
> If this system already exists forgive my ignorance and point my in the
> right direction so I can see what is there and find out how to contribute
> to it. I don't have the understanding to play with JDOM but I could at
> least put something useful back into the jdom project (as I seem to have
> taken a lot out).
> 
> /Phill
> IS Dept, Software Engineer.
> phill_perryman at mitel.com
> http://www.mitel.com
> Tel: +44 1291 436023
> ----- Forwarded by Phill Perryman/Cal/Mitel on 27/08/2003 08:21 -----
>                                                                                                                                        
>                       Paul Cantrell                                                                                                    
>                       <cantrell at pobox.co       To:       Jason Hunter <jhunter at servlets.com>, Per Norrman <pernorrman at telia.com>,      
>                       m>                         jdom-interest at jdom.org                                                                
>                       Sent by:                 cc:                                                                                     
>                       jdom-interest-admi       Subject:  Re: SV: [jdom-interest] Line numbers                                          
>                       n at jdom.org                                                                                                       
>                                                                                                                                        
>                                                                                                                                        
>                       26/08/2003 20:33                                                                                                 
>                                                                                                                                        
>                                                                                                                                        
> 
> 
> 
> 
> 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
>>
> 
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> 
> 
> 
> 
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> 




More information about the jdom-interest mailing list