Yes implement an entity resolver and plug it into the parser.

Regards

Erik Rydgren
Mandarinen systems AB
Sweden


-----Original Message-----
From: Laurent PETIT [mailto:[EMAIL PROTECTED]]
Sent: den 7 januari 2002 19:38
To: [EMAIL PROTECTED]
Subject: Re: Telling a parser to validate a document with a DTD non
specified in the document


>
> >Sorry for the repetition, but I 'll be surprised if there wasn't a
> >way to tell the parser the DTD to use ?
>
> Prepare to be surprised; as far as I know, that is not supported.

No problem, I was prepared  ;-)

> In parsers which support plug-in "entity resolvers" you can (ab)use that
> feature to substitute the contents of one DTD for another, but the
> architecture of XML is that the "external subset" (the DTD) is supposed to
> be specified by the document's author and only _checked_ by the
application
> which is reading it.

I remember the origin of the problem, and why the external subset was not
written in the XML by the supplier of the message : because we then had
problems with the real localisation of the file, in the machine where the
app using Xerces runs.
For example, the line for the DTD which was supplied :
<!DOCTYPE OrderProposalRequest SYSTEM "OrderProposalRequest.dtd">
but the REAL place for the DTD file was in a directory such as "dtd" and the
parse was failing over and over.

Maybe the solution choiced (to no longer write the DTD line in the incoming
message) was not the good one, indeed.

The QUESTION then becomes: If it is possible for the sender to write the DTD
line again, what are the ways to indicate to the parser which directories to
check in order to find the DTD ?

>
> You might want to consider doing some text-based manipulations before the
> document reaches the parser, to insert or change the DTD reference. But I
> don't really recommend that, since it will tend to produce a more fragile
> application than simply insisting that folks say what they mean.

I agree with you.

Thanks in advance,

Laurent.

>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to