On Wed, 2004-10-06 at 14:23, Peter wrote: > Hi > > I have a document with an external entity: > > <?xml version="1.0"?> > <!DOCTYPE hibernate-mapping PUBLIC > "-//Hibernate/Hibernate Mapping DTD//EN" > > "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"; > [ > <!ENTITY Contingency SYSTEM > "components/hsos.contingency.persistence.Contingency.xml"> > ] > > > > So "components/" is a sub directory in the same > directory this document is located in. According to > RFC 2396 the base URI for the relative path for the > external entity should fall back to the location of > this document. This works fine validating the doucment > with xmllint but when using dom4j/xerces it always > tries to use "." as the base URI. How can this > behaviour be changed/corrected?
Hi Peter, If you call a parse method passing a File or URI then entities *will* get resolved relative to the source location of the document. But if you call a parse method passing an InputSource or InputStream object, then xerces has no idea what the original source location of the document it is parsing *is*. I presume this is what the problem is in your case. When using an InputSource, you can call InputSource.setSystemId to tell the parser what the "source location" of the input document is. Regards, Simon --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]