Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

Re: [jdom-interest] debug everywhere

Paul Libbrecht

2007-01-22

Replies:


Just for the sake of completeness, there's a funny story behind this on
dom4j:

- in JDOM, you can use SAXReader.read(File) which is mostly the same as
File.toURI().toString() and that's good and should be such (it is good
since it allows relative resolution of, e.g., DTD references)
- in dom4j, there's a guy that discovered that file.toURL() does not
url-encode # hence turns a file with a # into a reference with an inner
id-reference... and they use this as an excuse not to use file.toURI()
when receiving a file, hence breaking all file-reading relative resolution.

Luckily File.toURI() does URL-encode #... but maybe it only comes in
modern flavours of JDK ?

paul


Michael Kay wrote:
>> To avoid treading the trepidating & unknown (at least, to me)
>> path towards using systemId, what I currently do is simply
>> create an InputSource from a File.
>>  
>
> File.toURI().toString()
>
> is a pretty reliable recipe.
>
> Michael Kay
> http://www.saxonica.com/
>
>  
>> -----Original Message-----
>> From: jdom-interest-bounces@(protected)
>> [mailto:jdom-interest-bounces@(protected)
>> Sent: Friday, January 19, 2007 6:00 PM
>> To: dmatthews@(protected)
>> Cc: jdom-interest@(protected)
>> Subject: Re: [jdom-interest] debug everywhere
>>
>> When you pass a string to the build() command you are passing
>> a systemId, not a path to file. Internally it's converted to
>> a SAX InputSource. Odds are it's a backslash related issue
>> in that you were lucky sometimes your file path worked as a
>> systemId, but on Windows it doesn't because of C: and backslashes.
>>
>> -jh-
>>
>> This email and any files transmitted with it are confidential
>> and intended solely for the use of the individual or entity
>> to whom they are addressed. If you have received this email
>> in error please notify the sender immediately. Please note
>> that any views or opinions presented in this email are solely
>> those of the author and do not necessarily represent those of
>> the company. Even though this company takes every precaution
>> to ensure this email is virus-free, the recipient should
>> check this email and any attachments for the presence of
>> viruses. The company accepts no liability for any damage
>> caused by any virus transmitted by this email.
>> Protedyne Corporation, 1000 Day Hill Rd, Windsor, CT 06095,
>> USA,                                            
>> www.protedyne.com
>>
>>  


Attachment: smime.p7s
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.