mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
parser: Only enable SAX2 if there are SAX2 element handlers
This reverts part of commit 235b15a5 for backward compatibility and
adds some comments trying to clarify the whole mess.
Fixes #623.
This commit is contained in:
@@ -745,6 +745,19 @@ struct _xmlSAXHandler {
|
||||
setDocumentLocatorSAXFunc setDocumentLocator;
|
||||
startDocumentSAXFunc startDocument;
|
||||
endDocumentSAXFunc endDocument;
|
||||
/*
|
||||
* `startElement` and `endElement` are only used by the legacy SAX1
|
||||
* interface and should not be used in new software. If you really
|
||||
* have to enable SAX1, the preferred way is set the `initialized`
|
||||
* member to 1 instead of XML_SAX2_MAGIC.
|
||||
*
|
||||
* For backward compatibility, it's also possible to set the
|
||||
* `startElementNs` and `endElementNs` handlers to NULL.
|
||||
*
|
||||
* You can also set the XML_PARSE_SAX1 parser option, but versions
|
||||
* older than 2.12.0 will probably crash if this option is provided
|
||||
* together with custom SAX callbacks.
|
||||
*/
|
||||
startElementSAXFunc startElement;
|
||||
endElementSAXFunc endElement;
|
||||
referenceSAXFunc reference;
|
||||
@@ -758,8 +771,14 @@ struct _xmlSAXHandler {
|
||||
getParameterEntitySAXFunc getParameterEntity;
|
||||
cdataBlockSAXFunc cdataBlock;
|
||||
externalSubsetSAXFunc externalSubset;
|
||||
/*
|
||||
* `initialized` should always be set to XML_SAX2_MAGIC to enable the
|
||||
* modern SAX2 interface.
|
||||
*/
|
||||
unsigned int initialized;
|
||||
/* The following fields are extensions available only on version 2 */
|
||||
/*
|
||||
* The following members are only used by the SAX2 interface.
|
||||
*/
|
||||
void *_private;
|
||||
startElementNsSAX2Func startElementNs;
|
||||
endElementNsSAX2Func endElementNs;
|
||||
|
||||
Reference in New Issue
Block a user