[ expat-Patches-599715 ] Enable undeclared DTD

noreply@sourceforge.net noreply@sourceforge.net
Sat Aug 24 16:29:02 2002

Patches item #599715, was opened at 2002-08-24 14:35
You can respond by visiting: 

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Karl Waclawek (kwaclaw)
Assigned to: Karl Waclawek (kwaclaw)
Summary: Enable undeclared DTD

Initial Comment:

SAX2 provides the ability to use a customer provided
external DTD when there is no external subset. Check
out the definition of getExternalSubset on this page:


I patched Expat to enable such behaviour.
When the user calls the new API function
XML_UseForeignDTD() with an argument of XML_TRUE,
then the externalEntityRefHandler will be called
even if there is no external subset/DTD declared.
In such a case the systemId argument will be NULL.

A "foreign DTD" would be interpreted just as if
the document had an external subset reference,
that is, the internal field dtd.hasParamEntityRefs
would become true.

Patch attached.
This patch also includes additional improvements/fixes
that became apparent when working on the patch.
These affect the function dtdReset() and the 


>Comment By: Karl Waclawek (kwaclaw)
Date: 2002-08-24 19:28

Logged In: YES 

Made small improvement to patch.

Thinking about changing the API from
XML_UseForeignDTD(parser, useDTD)
XML_SetUseForeignDTDHandler(parser, callback).

The value of the internal field useForeignDTD is used only
once, but updated multiple times. With the orginal API
the caller has write access to this field and can 
potentially mess up the logic, with the new one, the parser
reads it when it needs it, and then has full control.



You can respond by visiting: