Skip to content
Snippets Groups Projects
SAX.c 3.87 KiB
Newer Older
  • Learn to ignore specific revisions
  •  * SAX.c : Old SAX v1 handlers to build a tree.
     *         Deprecated except for compatibility
    
     *
     * See Copyright for the status of this software.
     *
    
     * Daniel Veillard <daniel@veillard.com>
    
    Bjorn Reese's avatar
    Bjorn Reese committed
    #include "libxml.h"
    
    #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>
    
    #include <libxml/HTMLtree.h>
    
    #ifdef LIBXML_LEGACY_ENABLED
    
     * @hdlr:  the SAX handler
     * @warning:  flag if non-zero sets the handler warning procedure
    
     * Initialize the default XML SAX version 1 handler
     * DEPRECATED: use xmlSAX2InitDefaultSAXHandler() for the new SAX2 blocks
    
    initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning)
    
        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;
    
        if (warning == 0)
    	hdlr->warning = NULL;
        else
    	hdlr->warning = xmlParserWarning;
        hdlr->error = xmlParserError;
        hdlr->fatalError = xmlParserError;
    
        hdlr->initialized = 1;
    }
    
     * Initialize the default HTML SAX version 1 handler
     * DEPRECATED: use xmlSAX2InitHtmlDefaultSAXHandler() for the new SAX2 blocks
    
    inithtmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
    
        hdlr->internalSubset = xmlSAX2InternalSubset;
    
        hdlr->externalSubset = NULL;
        hdlr->isStandalone = NULL;
        hdlr->hasInternalSubset = NULL;
        hdlr->hasExternalSubset = NULL;
        hdlr->resolveEntity = NULL;
    
        hdlr->getEntity = xmlSAX2GetEntity;
    
        hdlr->getParameterEntity = NULL;
        hdlr->entityDecl = NULL;
        hdlr->attributeDecl = NULL;
        hdlr->elementDecl = NULL;
        hdlr->notationDecl = NULL;
        hdlr->unparsedEntityDecl = NULL;
    
        hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
        hdlr->startDocument = xmlSAX2StartDocument;
        hdlr->endDocument = xmlSAX2EndDocument;
        hdlr->startElement = xmlSAX2StartElement;
        hdlr->endElement = xmlSAX2EndElement;
    
        hdlr->characters = xmlSAX2Characters;
        hdlr->cdataBlock = xmlSAX2CDataBlock;
        hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
    
        hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
    
        hdlr->warning = xmlParserWarning;
        hdlr->error = xmlParserError;
        hdlr->fatalError = xmlParserError;
    
        hdlr->initialized = 1;
    }
    
    #endif /* LIBXML_SAX1_ENABLED */
    
    #endif /* LIBXML_LEGACY_ENABLED */