[ 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: 
https://sourceforge.net/tracker/?func=detail&atid=310127&aid=599715&group_id=10127

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:

http://sax.sourceforge.net/apidoc/org/xml/sax/ext/Entity
Resolver2.html

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 
notStandaloneHandler().

----------------------------------------------------------------------

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

Message:
Logged In: YES 
user_id=290026

Made small improvement to patch.

Thinking about changing the API from
XML_UseForeignDTD(parser, useDTD)
to
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.

Comments?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=310127&aid=599715&group_id=10127