Paul Cercueil / libxml2

Dependents:   libiio

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SAX.c Source File

SAX.c

00001 /*
00002  * SAX.c : Old SAX v1 handlers to build a tree.
00003  *         Deprecated except for compatibility
00004  *
00005  * See Copyright for the status of this software.
00006  *
00007  * Daniel Veillard <daniel@veillard.com>
00008  */
00009 
00010 
00011 #define IN_LIBXML
00012 #include "libxml.h"
00013 #include <stdlib.h>
00014 #include <string.h>
00015 #include <libxml/xmlmemory.h>
00016 #include <libxml/tree.h>
00017 #include <libxml/parser.h>
00018 #include <libxml/parserInternals.h>
00019 #include <libxml/valid.h>
00020 #include <libxml/entities.h>
00021 #include <libxml/xmlerror.h>
00022 #include <libxml/debugXML.h>
00023 #include <libxml/xmlIO.h>
00024 #include <libxml/SAX.h>
00025 #include <libxml/uri.h>
00026 #include <libxml/valid.h>
00027 #include <libxml/HTMLtree.h>
00028 #include <libxml/globals.h>
00029 #include <libxml/SAX2.h>
00030 
00031 #ifdef LIBXML_LEGACY_ENABLED
00032 #ifdef LIBXML_SAX1_ENABLED
00033 /**
00034  * initxmlDefaultSAXHandler:
00035  * @hdlr:  the SAX handler
00036  * @warning:  flag if non-zero sets the handler warning procedure
00037  *
00038  * Initialize the default XML SAX version 1 handler
00039  * DEPRECATED: use xmlSAX2InitDefaultSAXHandler() for the new SAX2 blocks
00040  */
00041 void
00042 initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning)
00043 {
00044 
00045     if(hdlr->initialized == 1)
00046     return;
00047 
00048     hdlr->internalSubset = xmlSAX2InternalSubset;
00049     hdlr->externalSubset = xmlSAX2ExternalSubset;
00050     hdlr->isStandalone = xmlSAX2IsStandalone;
00051     hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
00052     hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
00053     hdlr->resolveEntity = xmlSAX2ResolveEntity;
00054     hdlr->getEntity = xmlSAX2GetEntity;
00055     hdlr->getParameterEntity = xmlSAX2GetParameterEntity;
00056     hdlr->entityDecl = xmlSAX2EntityDecl;
00057     hdlr->attributeDecl = xmlSAX2AttributeDecl;
00058     hdlr->elementDecl = xmlSAX2ElementDecl;
00059     hdlr->notationDecl = xmlSAX2NotationDecl;
00060     hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl;
00061     hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
00062     hdlr->startDocument = xmlSAX2StartDocument;
00063     hdlr->endDocument = xmlSAX2EndDocument;
00064     hdlr->startElement = xmlSAX2StartElement;
00065     hdlr->endElement = xmlSAX2EndElement;
00066     hdlr->reference = xmlSAX2Reference;
00067     hdlr->characters = xmlSAX2Characters;
00068     hdlr->cdataBlock = xmlSAX2CDataBlock;
00069     hdlr->ignorableWhitespace = xmlSAX2Characters;
00070     hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
00071     if (warning == 0)
00072     hdlr->warning = NULL;
00073     else
00074     hdlr->warning = xmlParserWarning;
00075     hdlr->error = xmlParserError;
00076     hdlr->fatalError = xmlParserError;
00077 
00078     hdlr->initialized = 1;
00079 }
00080 
00081 #ifdef LIBXML_HTML_ENABLED
00082 
00083 /**
00084  * inithtmlDefaultSAXHandler:
00085  * @hdlr:  the SAX handler
00086  *
00087  * Initialize the default HTML SAX version 1 handler
00088  * DEPRECATED: use xmlSAX2InitHtmlDefaultSAXHandler() for the new SAX2 blocks
00089  */
00090 void
00091 inithtmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
00092 {
00093     if(hdlr->initialized == 1)
00094     return;
00095 
00096     hdlr->internalSubset = xmlSAX2InternalSubset;
00097     hdlr->externalSubset = NULL;
00098     hdlr->isStandalone = NULL;
00099     hdlr->hasInternalSubset = NULL;
00100     hdlr->hasExternalSubset = NULL;
00101     hdlr->resolveEntity = NULL;
00102     hdlr->getEntity = xmlSAX2GetEntity;
00103     hdlr->getParameterEntity = NULL;
00104     hdlr->entityDecl = NULL;
00105     hdlr->attributeDecl = NULL;
00106     hdlr->elementDecl = NULL;
00107     hdlr->notationDecl = NULL;
00108     hdlr->unparsedEntityDecl = NULL;
00109     hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
00110     hdlr->startDocument = xmlSAX2StartDocument;
00111     hdlr->endDocument = xmlSAX2EndDocument;
00112     hdlr->startElement = xmlSAX2StartElement;
00113     hdlr->endElement = xmlSAX2EndElement;
00114     hdlr->reference = NULL;
00115     hdlr->characters = xmlSAX2Characters;
00116     hdlr->cdataBlock = xmlSAX2CDataBlock;
00117     hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
00118     hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
00119     hdlr->comment = xmlSAX2Comment;
00120     hdlr->warning = xmlParserWarning;
00121     hdlr->error = xmlParserError;
00122     hdlr->fatalError = xmlParserError;
00123 
00124     hdlr->initialized = 1;
00125 }
00126 
00127 #endif /* LIBXML_HTML_ENABLED */
00128 
00129 #ifdef LIBXML_DOCB_ENABLED
00130 /**
00131  * initdocbDefaultSAXHandler:
00132  * @hdlr:  the SAX handler
00133  *
00134  * Initialize the default DocBook SAX version 1 handler
00135  * DEPRECATED: use xmlSAX2InitDocbDefaultSAXHandler() for the new SAX2 blocks
00136  */
00137 void
00138 initdocbDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
00139 {
00140     if(hdlr->initialized == 1)
00141     return;
00142 
00143     hdlr->internalSubset = xmlSAX2InternalSubset;
00144     hdlr->externalSubset = NULL;
00145     hdlr->isStandalone = xmlSAX2IsStandalone;
00146     hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
00147     hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
00148     hdlr->resolveEntity = xmlSAX2ResolveEntity;
00149     hdlr->getEntity = xmlSAX2GetEntity;
00150     hdlr->getParameterEntity = NULL;
00151     hdlr->entityDecl = xmlSAX2EntityDecl;
00152     hdlr->attributeDecl = NULL;
00153     hdlr->elementDecl = NULL;
00154     hdlr->notationDecl = NULL;
00155     hdlr->unparsedEntityDecl = NULL;
00156     hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
00157     hdlr->startDocument = xmlSAX2StartDocument;
00158     hdlr->endDocument = xmlSAX2EndDocument;
00159     hdlr->startElement = xmlSAX2StartElement;
00160     hdlr->endElement = xmlSAX2EndElement;
00161     hdlr->reference = xmlSAX2Reference;
00162     hdlr->characters = xmlSAX2Characters;
00163     hdlr->cdataBlock = NULL;
00164     hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
00165     hdlr->processingInstruction = NULL;
00166     hdlr->comment = xmlSAX2Comment;
00167     hdlr->warning = xmlParserWarning;
00168     hdlr->error = xmlParserError;
00169     hdlr->fatalError = xmlParserError;
00170 
00171     hdlr->initialized = 1;
00172 }
00173 
00174 #endif /* LIBXML_DOCB_ENABLED */
00175 
00176 #endif /* LIBXML_SAX1_ENABLED */
00177 
00178 #define bottom_SAX
00179 #include "elfgcchack.h"
00180 #endif /* LIBXML_LEGACY_ENABLED */
00181