> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]

> ---- you "Stephane Bailliez" <[EMAIL PROTECTED]> wrote ----
> > Now the final question: what is the systemid syntax for files ? :-)
> 
> Ah-ha! I was just looking into that yesterday.  I think I've come to a
> 'good enough' conclusion although I'm still not quite happy 
> with it.  (Of
> course the difference what the specs say and what common 
> programs actually
> implement is also a point to remember...)

Yes..unfortunately this is just like HTTP. We have to deal with unclear
specs that gave birth to various possible interpretations...

> ---- Xalan note:
> I'm sure there are a couple of places where Xalan code does not handle
> relative URL's correctly.  Help us find them and I'll 
> definitely work on
> fixing them.  I have a basic SystemIDTest already although I 
> both need to
> update it a bit and also create another SpecialSystemIdTest 
> that covers
> other non-file: URLs (which require special network setup 
> obviously, so I
> may exclude it from the smoketest, etc.)

Since there is a good deal of place that are concerned...I think it would be
much better to create first a URI related class that can factorize this
crazy set of systemid magic and put the logic right here. We have now to
deal with a great deal of malformed systemid that follow us for years. :-(

All I can think of is some sort of:

class MalformedSystemId extends IOException

class URIUtils {
// transform a file into a valid systemid
static String getSystemId(File file);

// do a strict validation of the systemid !
void validate(String systemid) throws MalformedSystemId;

// send back a valid systemid uri modified if necessary
// to deal with various syntax errors.
static String normalize(String weirdsystemid) throws MalformedSystemId;

// transform a systemid into a file object if possible
static File toFile(String weirdsystemid) throws MalformedSystemId;

//...
}


> Oh: side note: the java.net.URL class is notoriously bad at 
> manipulating
> URL formats, so don't count on it to tell you what the spec says.

Yep. This is crap. :-(

I think a real URI class would be a nice addition to Jakarta-Commons if not
already in the pipe.

-- 
 St�phane Bailliez 
 Software Engineer, Paris - France 
 iMediation - http://www.imediation.com 
 Disclaimer: All the opinions expressed above are mine and not those from my
company. 


Reply via email to