Laurent,

You can set up an empty document that does have the DOCTYPE, create a parser
for that and reuse that parser for new documents.

Here's an example of what that would look like that Alberto Massari sent me
ages ago:

XMLByte* dummyXML="<?xml version=\"1.0\"?> <!DOCTYPE OrderProposalRequest
SYSTEM \"dtd/OrderProposalRequest.dtd\"> <OrderProposalRequest/>";
MemBufInputSource inputSource(dummyXML,strlen(dummyXML),"dummy",false);
SAXParser sp;
sp.setDoValidation(true);
sp.parse(inputSource);

// now, reuse the validator and parse the new doc
FileInputSource inputSource2("somefile.xml");
sp.parse(inputSource2, true);

> -----Original Message-----
> From: Laurent PETIT [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 07, 2002 18:17 PM
> To: [EMAIL PROTECTED]
> Subject: Telling a parser to validate a document with a DTD non
> specified in the document
>
>
> Hello,
>
> I'm using Xerces C++ on AIX. (Version 1.5.2).
>
> My program receives an XML document.
> I want to validate this document. The problem is that the line
> for the DTD is not present :
> <?xml version="1.0" encoding="iso-8859-1" ?>
> <OrderProposalRequest>
> ...
> </OrderProposalRequest>
>
> The method used in the project is to add a line for the DTD :
> <?xml version="1.0" encoding="iso-8859-1" ?>
> <!DOCTYPE OrderProposalRequest SYSTEM "dtd/OrderProposalRequest.dtd">
> <OrderProposalRequest>
> ...
> </OrderProposalRequest>
>
> This sounds weird to me.
> I think there certainly is a method to tell the parser which DTD
> to use, if none is present in the document ?
>
> I read the documentation of certain classes in xml.apache.org
> apiDoc (SAX2XMLReader, XMLValidator) but I can't guess the way to do it.
>
> Please help.
>
> Thanks in advance,
>
> Laurent PETIT.
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to