You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Bell, David I" <da...@hp.com> on 2000/04/17 21:09:23 UTC

FW: Specifying a specific DTD for parsing

Hi All,

Anyone know if the attached discussion applies to the Java implementation
too?

Regards,

David I. Bell
Hewlett-Packard Laboratories
mailto:David_I_Bell@hp.com





-----Original Message-----
From: roddey@us.ibm.com [mailto:roddey@us.ibm.com]
Sent: Monday, April 17, 2000 11:00 AM
To: xerces-c-dev@xml.apache.org
Subject: Re: Specifying a specific DTD for parsing





In your program, create a small in memory file that references your DTD
(see the MemParse sample) and parse it. This will load the validator with
your DTD information. In subsequent parses, set the 'reuseValidator' flag
on the parse() call. This will cause any DTD in the document to be ignored
and the same data in the validator reused.

NOTE: The file cannot have any internal subset or it will be considered an
error (since that might have changed things in a way that we cannot easily
forsee.) So the files must either have no DTD or just an external DTD. If
they have an external DTD it will just not be parsed and validator will be
left as is and used with whatever element, attr, etc... declarations are
currently in it.

----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
roddey@us.ibm.com



Tom Jordahl <to...@allaire.com> on 04/17/2000 10:28:15 AM

Please respond to xerces-c-dev@xml.apache.org

To:   xerces-c-dev@xml.apache.org
cc:
Subject:  Specifying a specific DTD for parsing



Hello,

I am using the SAX api to validate XML data that can come
from untrusted sources.  This being the case, I want to specify
the DTD to validate against, and have the Xerces C++ parser use
*only* that DTD.

The obvious use of this is to validate B2B XML before trying
to extract data from it.

I was going to attempt to use the DTDHandler callbacks to ignore
any DTD that wasn't my own, but this doesn't look very promising.

Did I miss some existing functionality that would allow me to
specify the exact DTD I want to parse/validate with?

This seems like a problem others may have solved already.
Has anyone given thought as to how to use SAX to accomplish this?

Thanks.

--
Tom Jordahl              tomj@allaire.com
Allaire Corp.            http://www.allaire.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org