2001-02-23 17:55:21 +00:00
/*
2003-08-20 22:54:39 +00:00
* SAX . c : Old SAX v1 handlers to build a tree .
* Deprecated except for compatibility
2001-02-23 17:55:21 +00:00
*
* See Copyright for the status of this software .
*
2001-06-24 12:13:24 +00:00
* Daniel Veillard < daniel @ veillard . com >
2001-02-23 17:55:21 +00:00
*/
2002-03-18 19:37:11 +00:00
# define IN_LIBXML
2001-04-21 16:57:29 +00:00
# include "libxml.h"
2001-02-23 17:55:21 +00:00
# include <stdlib.h>
# include <string.h>
# include <libxml/xmlmemory.h>
# include <libxml/tree.h>
# include <libxml/parser.h>
# include <libxml/parserInternals.h>
# include <libxml/valid.h>
# include <libxml/entities.h>
# include <libxml/xmlerror.h>
# include <libxml/debugXML.h>
# include <libxml/xmlIO.h>
# include <libxml/SAX.h>
# include <libxml/uri.h>
2001-08-07 01:10:10 +00:00
# include <libxml/valid.h>
2001-02-23 17:55:21 +00:00
# include <libxml/HTMLtree.h>
2001-10-17 15:58:35 +00:00
# include <libxml/globals.h>
2003-08-20 22:54:39 +00:00
# include <libxml/SAX2.h>
2001-02-23 17:55:21 +00:00
2003-09-30 00:43:48 +00:00
# ifdef LIBXML_SAX1_ENABLED
2001-02-23 17:55:21 +00:00
/**
2002-01-22 18:15:52 +00:00
* initxmlDefaultSAXHandler :
2001-12-31 16:16:02 +00:00
* @ hdlr : the SAX handler
* @ warning : flag if non - zero sets the handler warning procedure
2001-02-23 17:55:21 +00:00
*
2003-08-20 22:54:39 +00:00
* Initialize the default XML SAX version 1 handler
* DEPRECATED : use xmlSAX2InitDefaultSAXHandler ( ) for the new SAX2 blocks
2001-02-23 17:55:21 +00:00
*/
void
2003-09-25 14:29:29 +00:00
initxmlDefaultSAXHandler ( xmlSAXHandlerV1 * hdlr , int warning )
2001-02-23 17:55:21 +00:00
{
2003-08-20 22:54:39 +00:00
2001-10-13 09:15:48 +00:00
if ( hdlr - > initialized = = 1 )
2001-07-08 13:15:55 +00:00
return ;
2003-08-20 22:54:39 +00:00
hdlr - > internalSubset = xmlSAX2InternalSubset ;
hdlr - > externalSubset = xmlSAX2ExternalSubset ;
hdlr - > isStandalone = xmlSAX2IsStandalone ;
hdlr - > hasInternalSubset = xmlSAX2HasInternalSubset ;
hdlr - > hasExternalSubset = xmlSAX2HasExternalSubset ;
hdlr - > resolveEntity = xmlSAX2ResolveEntity ;
hdlr - > getEntity = xmlSAX2GetEntity ;
hdlr - > getParameterEntity = xmlSAX2GetParameterEntity ;
hdlr - > entityDecl = xmlSAX2EntityDecl ;
hdlr - > attributeDecl = xmlSAX2AttributeDecl ;
hdlr - > elementDecl = xmlSAX2ElementDecl ;
hdlr - > notationDecl = xmlSAX2NotationDecl ;
hdlr - > unparsedEntityDecl = xmlSAX2UnparsedEntityDecl ;
hdlr - > setDocumentLocator = xmlSAX2SetDocumentLocator ;
hdlr - > startDocument = xmlSAX2StartDocument ;
hdlr - > endDocument = xmlSAX2EndDocument ;
hdlr - > startElement = xmlSAX2StartElement ;
hdlr - > endElement = xmlSAX2EndElement ;
hdlr - > reference = xmlSAX2Reference ;
hdlr - > characters = xmlSAX2Characters ;
hdlr - > cdataBlock = xmlSAX2CDataBlock ;
hdlr - > ignorableWhitespace = xmlSAX2Characters ;
hdlr - > processingInstruction = xmlSAX2ProcessingInstruction ;
2001-10-13 09:15:48 +00:00
if ( warning = = 0 )
hdlr - > warning = NULL ;
2001-02-23 17:55:21 +00:00
else
2001-10-13 09:15:48 +00:00
hdlr - > warning = xmlParserWarning ;
hdlr - > error = xmlParserError ;
hdlr - > fatalError = xmlParserError ;
2001-07-08 13:15:55 +00:00
2001-10-13 09:15:48 +00:00
hdlr - > initialized = 1 ;
2001-02-23 17:55:21 +00:00
}
2003-09-30 00:43:48 +00:00
# endif /* LIBXML_SAX1_ENABLED */
2001-02-23 17:55:21 +00:00
2001-10-13 09:15:48 +00:00
# ifdef LIBXML_HTML_ENABLED
2001-02-23 17:55:21 +00:00
/**
2002-01-22 18:15:52 +00:00
* inithtmlDefaultSAXHandler :
2001-12-31 16:16:02 +00:00
* @ hdlr : the SAX handler
2001-02-23 17:55:21 +00:00
*
2003-08-20 22:54:39 +00:00
* Initialize the default HTML SAX version 1 handler
* DEPRECATED : use xmlSAX2InitHtmlDefaultSAXHandler ( ) for the new SAX2 blocks
2001-02-23 17:55:21 +00:00
*/
void
2003-09-25 14:29:29 +00:00
inithtmlDefaultSAXHandler ( xmlSAXHandlerV1 * hdlr )
2001-02-23 17:55:21 +00:00
{
2001-10-13 09:15:48 +00:00
if ( hdlr - > initialized = = 1 )
2001-07-08 13:15:55 +00:00
return ;
2003-08-20 22:54:39 +00:00
hdlr - > internalSubset = xmlSAX2InternalSubset ;
2001-10-13 09:15:48 +00:00
hdlr - > externalSubset = NULL ;
hdlr - > isStandalone = NULL ;
hdlr - > hasInternalSubset = NULL ;
hdlr - > hasExternalSubset = NULL ;
hdlr - > resolveEntity = NULL ;
2003-08-20 22:54:39 +00:00
hdlr - > getEntity = xmlSAX2GetEntity ;
2001-10-13 09:15:48 +00:00
hdlr - > getParameterEntity = NULL ;
hdlr - > entityDecl = NULL ;
hdlr - > attributeDecl = NULL ;
hdlr - > elementDecl = NULL ;
hdlr - > notationDecl = NULL ;
hdlr - > unparsedEntityDecl = NULL ;
2003-08-20 22:54:39 +00:00
hdlr - > setDocumentLocator = xmlSAX2SetDocumentLocator ;
hdlr - > startDocument = xmlSAX2StartDocument ;
hdlr - > endDocument = xmlSAX2EndDocument ;
hdlr - > startElement = xmlSAX2StartElement ;
hdlr - > endElement = xmlSAX2EndElement ;
2001-10-13 09:15:48 +00:00
hdlr - > reference = NULL ;
2003-08-20 22:54:39 +00:00
hdlr - > characters = xmlSAX2Characters ;
hdlr - > cdataBlock = xmlSAX2CDataBlock ;
hdlr - > ignorableWhitespace = xmlSAX2IgnorableWhitespace ;
2004-10-22 14:34:23 +00:00
hdlr - > processingInstruction = xmlSAX2ProcessingInstruction ;
2001-10-13 09:15:48 +00:00
hdlr - > processingInstruction = NULL ;
2003-08-20 22:54:39 +00:00
hdlr - > comment = xmlSAX2Comment ;
2001-10-13 09:15:48 +00:00
hdlr - > warning = xmlParserWarning ;
hdlr - > error = xmlParserError ;
hdlr - > fatalError = xmlParserError ;
hdlr - > initialized = 1 ;
2001-02-23 17:55:21 +00:00
}
2001-10-13 09:15:48 +00:00
2001-04-23 13:41:34 +00:00
# endif /* LIBXML_HTML_ENABLED */
2001-02-23 17:55:21 +00:00
2001-04-23 13:41:34 +00:00
# ifdef LIBXML_DOCB_ENABLED
2001-10-13 09:15:48 +00:00
2001-12-31 16:16:02 +00:00
/**
2002-01-22 18:15:52 +00:00
* initdocbDefaultSAXHandler :
2001-12-31 16:16:02 +00:00
* @ hdlr : the SAX handler
*
2003-08-20 22:54:39 +00:00
* Initialize the default DocBook SAX version 1 handler
* DEPRECATED : use xmlSAX2InitDocbDefaultSAXHandler ( ) for the new SAX2 blocks
2001-12-31 16:16:02 +00:00
*/
2001-10-13 09:15:48 +00:00
void
2003-09-25 14:29:29 +00:00
initdocbDefaultSAXHandler ( xmlSAXHandlerV1 * hdlr )
2001-10-13 09:15:48 +00:00
{
if ( hdlr - > initialized = = 1 )
return ;
2003-08-20 22:54:39 +00:00
hdlr - > internalSubset = xmlSAX2InternalSubset ;
2001-10-13 09:15:48 +00:00
hdlr - > externalSubset = NULL ;
2003-08-20 22:54:39 +00:00
hdlr - > isStandalone = xmlSAX2IsStandalone ;
hdlr - > hasInternalSubset = xmlSAX2HasInternalSubset ;
hdlr - > hasExternalSubset = xmlSAX2HasExternalSubset ;
hdlr - > resolveEntity = xmlSAX2ResolveEntity ;
hdlr - > getEntity = xmlSAX2GetEntity ;
2001-10-13 09:15:48 +00:00
hdlr - > getParameterEntity = NULL ;
2003-08-20 22:54:39 +00:00
hdlr - > entityDecl = xmlSAX2EntityDecl ;
2001-10-13 09:15:48 +00:00
hdlr - > attributeDecl = NULL ;
hdlr - > elementDecl = NULL ;
hdlr - > notationDecl = NULL ;
hdlr - > unparsedEntityDecl = NULL ;
2003-08-20 22:54:39 +00:00
hdlr - > setDocumentLocator = xmlSAX2SetDocumentLocator ;
hdlr - > startDocument = xmlSAX2StartDocument ;
hdlr - > endDocument = xmlSAX2EndDocument ;
hdlr - > startElement = xmlSAX2StartElement ;
hdlr - > endElement = xmlSAX2EndElement ;
hdlr - > reference = xmlSAX2Reference ;
hdlr - > characters = xmlSAX2Characters ;
2001-10-13 09:15:48 +00:00
hdlr - > cdataBlock = NULL ;
2003-08-20 22:54:39 +00:00
hdlr - > ignorableWhitespace = xmlSAX2IgnorableWhitespace ;
2001-10-13 09:15:48 +00:00
hdlr - > processingInstruction = NULL ;
2003-08-20 22:54:39 +00:00
hdlr - > comment = xmlSAX2Comment ;
2001-10-13 09:15:48 +00:00
hdlr - > warning = xmlParserWarning ;
hdlr - > error = xmlParserError ;
hdlr - > fatalError = xmlParserError ;
hdlr - > initialized = 1 ;
}
2001-02-23 17:55:21 +00:00
2001-04-23 13:41:34 +00:00
# endif /* LIBXML_DOCB_ENABLED */