Hi Ken,
I believe Xerces resolves relative entity systemIds against the
systemId of the input source it's parsing, if that has a systemId.
I believe that's intended, but I don't know whether it is well
documented (or whether it's specified by SAX one way or the other).
All you need to do to get past this is to provide an absolute
systemId instead. Here's what I'd do:
String workDir = System.getProperty("user.dir");
try {
return new InputSource(new File(workDir, "foo.dtd").toURL().toString());
} catch(MalformedURLException mue) {
return null;
}
The system property "user.dir" is standard, see
http://java.sun.com/docs/books/tutorial/essential/system/properties.html
Probably works to just use File.toString() directly, but
the toURL() stuff converts it to the canonical well-formed
URL syntax, which seems more robust to me.
Cheers,
- Gulli
-----Original Message-----
From: Ken Goldman [mailto:[EMAIL PROTECTED]]
Sent: 31. j�l� 2001 14:06
To: [EMAIL PROTECTED]
Subject: EntityResolver and relative path
I'm implementing EntityResolver, and for a certain DTD entity, I
have in resolveEntity
return new InputSource(./foo.dtd);
I expected the first dot in "./foo.dtd" to mean
"relative to the directory where I started the program".
It appears that Xerces is treating the dot as
"relative to where the xml document being parsed resides."
Is this expected? Is it documented? Is it unexpected, and possibly a
bug?
--
Ken Goldman [EMAIL PROTECTED] 914-784-7646
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]