[XML-SIG] Relative URI

paul@boddie.net paul@boddie.net
1 Nov 2001 18:07:59 -0000


"Jan Delgado" <Jan.Delgado@unamite.com> wrote:
>
><unknown>:2:47: Cannot resolve relative URI 'order.dtd' 
>when document URI unknown
>
>how can i set the document URI ?

Then:

>i solved the problem by defining the dtd-reference as something like:
>
><!DOCTYPE order SYSTEM "file:///home/paco/order.dtd">
>
>that works like expected.

I suppose that what you should do, based on my experience with Xerces-J rather 
than PyXML, is to either make sure that the DTD resides in the same directory 
as the XML file, or resides in the same "base" location as the XML resource (if 
you're not using a file).

If that isn't the case, you need to overload the way the parser goes about 
finding the DTD. In JAXP (Java APIs for XML Parsing) you would implement the 
org.xml.sax.EntityResolver interface in a class with a special version of the 
resolveEntity method. Then you would pass an instance of this class to the 
parser or reader through some method like DocumentBuilder.setEntityResolver.

This is all speculation with respect to PyXML or 4Suite, though. I just hope 
one doesn't have to jump through as many hoops as you do with so many things in 
the Java APIs. One would think that no-one would ever need to do this kind of 
thing, given the complexity of the API...

Paul

-- 
Get your firstname@lastname email for FREE at http://Nameplanet.com/?su