Implement your own EntityResolver (and instruct the parser to use it via 
setEntityResolver).  Your entity resolver will return an InputSource given 
a public id and a system id (in your case the input source will be a 
LocalFileInputSource).  There is a sample called Redirect in the Xerces 
distribution which does exactly what you describe.  The sample uses SAX, 
but setEntityResolver is a member of DOMParser as well.  If your don't 
recognize the id, just return NULL and the parser will take it's default 
action.

Chris

At 03:49 PM 5/11/2001, you wrote:
>This is more a general DOM question than Xerces-C.  Is that OK here,
>or is there a better forum?
>
>I'm validating a document which has a DOCTYPE using PUBLIC and
>specifying both a name and a URI.  I'd like to tell the parser to use a
>local copy of the DTD, rather than to go out on the Internet.
>
>I don't see anything in the API.  I was hoping for a parameter to
>parse, or something in the constructor.  Even if there was, I'd need
>the document type before I could specify the DTD.
>
>I see calls like parseFirst and parseNext which I think do incremental
>parsing.  But even if I get the root element that way, how can I stop
>the operation, specify a DTD, and restart?
>
>--
>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]

Reply via email to