13473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/* 21af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard * SAX.c : Old SAX v1 handlers to build a tree. 31af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard * Deprecated except for compatibility 43473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * 53473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * See Copyright for the status of this software. 63473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * 7c5d64345cf19bfd72418eb0a837869b0462e9130Daniel Veillard * Daniel Veillard <daniel@veillard.com> 83473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 93473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 103473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 1134ce8bece2f22cc99d25221b77315cd008f4866bDaniel Veillard#define IN_LIBXML 1270a9da54eb200cd5c5ceafb72aff72c39021c94cBjorn Reese#include "libxml.h" 133473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <stdlib.h> 143473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <string.h> 153473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/xmlmemory.h> 163473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/tree.h> 173473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/parser.h> 183473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/parserInternals.h> 193473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/valid.h> 203473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/entities.h> 213473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/xmlerror.h> 223473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/debugXML.h> 233473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/xmlIO.h> 243473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/SAX.h> 253473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/uri.h> 2648da91009715d1fcafa5f2b48b58e4009a41e998Daniel Veillard#include <libxml/valid.h> 273473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor#include <libxml/HTMLtree.h> 283c01b1d81b696fe8624b6d7e26ec0ebffcc7c06bDaniel Veillard#include <libxml/globals.h> 291af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard#include <libxml/SAX2.h> 303473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 3121e4ef20f64ebd740ebac0ead5d85a5631d2db5eWilliam M. Brack#ifdef LIBXML_LEGACY_ENABLED 328127390f0332ddf545fe59e406996deaedfee964Daniel Veillard#ifdef LIBXML_SAX1_ENABLED 333473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/** 349d06d300a5c4146907b3af8fcbf67d8e7d868567Daniel Veillard * initxmlDefaultSAXHandler: 35cbaf399537a1fb69ef97b079e4cb553869aaa4d9Daniel Veillard * @hdlr: the SAX handler 36cbaf399537a1fb69ef97b079e4cb553869aaa4d9Daniel Veillard * @warning: flag if non-zero sets the handler warning procedure 373473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * 381af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard * Initialize the default XML SAX version 1 handler 391af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard * DEPRECATED: use xmlSAX2InitDefaultSAXHandler() for the new SAX2 blocks 403473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 413473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylorvoid 42092643b52d29e6b721c257c4c88efa8259eebfe9Daniel VeillardinitxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning) 433473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor{ 44f8e3db0445a1bc8cfe3f77326b07ec161482caa2Daniel Veillard 45d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard if(hdlr->initialized == 1) 467583a59b5a0792599a181f77aaf0a39749fada27Daniel Veillard return; 477583a59b5a0792599a181f77aaf0a39749fada27Daniel Veillard 481af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->internalSubset = xmlSAX2InternalSubset; 491af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->externalSubset = xmlSAX2ExternalSubset; 501af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->isStandalone = xmlSAX2IsStandalone; 511af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->hasInternalSubset = xmlSAX2HasInternalSubset; 521af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->hasExternalSubset = xmlSAX2HasExternalSubset; 531af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->resolveEntity = xmlSAX2ResolveEntity; 541af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->getEntity = xmlSAX2GetEntity; 551af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->getParameterEntity = xmlSAX2GetParameterEntity; 561af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->entityDecl = xmlSAX2EntityDecl; 571af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->attributeDecl = xmlSAX2AttributeDecl; 581af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->elementDecl = xmlSAX2ElementDecl; 591af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->notationDecl = xmlSAX2NotationDecl; 601af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl; 611af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator; 621af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->startDocument = xmlSAX2StartDocument; 631af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->endDocument = xmlSAX2EndDocument; 641af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->startElement = xmlSAX2StartElement; 651af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->endElement = xmlSAX2EndElement; 661af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->reference = xmlSAX2Reference; 671af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->characters = xmlSAX2Characters; 681af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->cdataBlock = xmlSAX2CDataBlock; 691af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->ignorableWhitespace = xmlSAX2Characters; 701af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->processingInstruction = xmlSAX2ProcessingInstruction; 71d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard if (warning == 0) 72d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->warning = NULL; 733473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor else 74d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->warning = xmlParserWarning; 75d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->error = xmlParserError; 76d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->fatalError = xmlParserError; 777583a59b5a0792599a181f77aaf0a39749fada27Daniel Veillard 78d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->initialized = 1; 793473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor} 803473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 81d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard#ifdef LIBXML_HTML_ENABLED 823473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 833473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor/** 849d06d300a5c4146907b3af8fcbf67d8e7d868567Daniel Veillard * inithtmlDefaultSAXHandler: 85cbaf399537a1fb69ef97b079e4cb553869aaa4d9Daniel Veillard * @hdlr: the SAX handler 863473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor * 871af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard * Initialize the default HTML SAX version 1 handler 881af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard * DEPRECATED: use xmlSAX2InitHtmlDefaultSAXHandler() for the new SAX2 blocks 893473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor */ 903473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylorvoid 91092643b52d29e6b721c257c4c88efa8259eebfe9Daniel VeillardinithtmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr) 923473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor{ 93d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard if(hdlr->initialized == 1) 947583a59b5a0792599a181f77aaf0a39749fada27Daniel Veillard return; 957583a59b5a0792599a181f77aaf0a39749fada27Daniel Veillard 961af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->internalSubset = xmlSAX2InternalSubset; 97d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->externalSubset = NULL; 98d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->isStandalone = NULL; 99d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->hasInternalSubset = NULL; 100d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->hasExternalSubset = NULL; 101d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->resolveEntity = NULL; 1021af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->getEntity = xmlSAX2GetEntity; 103d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->getParameterEntity = NULL; 104d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->entityDecl = NULL; 105d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->attributeDecl = NULL; 106d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->elementDecl = NULL; 107d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->notationDecl = NULL; 108d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->unparsedEntityDecl = NULL; 1091af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator; 1101af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->startDocument = xmlSAX2StartDocument; 1111af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->endDocument = xmlSAX2EndDocument; 1121af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->startElement = xmlSAX2StartElement; 1131af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->endElement = xmlSAX2EndElement; 114d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->reference = NULL; 1151af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->characters = xmlSAX2Characters; 1161af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->cdataBlock = xmlSAX2CDataBlock; 1171af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace; 118fc484dd0a01b5f8f2187dd8a6791d5f8677fa816Daniel Veillard hdlr->processingInstruction = xmlSAX2ProcessingInstruction; 1191af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->comment = xmlSAX2Comment; 120d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->warning = xmlParserWarning; 121d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->error = xmlParserError; 122d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->fatalError = xmlParserError; 123d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard 124d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->initialized = 1; 1253473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor} 126d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard 127eae522a0d8aa9f830d2e447f29b504030dbb6bbdDaniel Veillard#endif /* LIBXML_HTML_ENABLED */ 1283473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 129eae522a0d8aa9f830d2e447f29b504030dbb6bbdDaniel Veillard#ifdef LIBXML_DOCB_ENABLED 130cbaf399537a1fb69ef97b079e4cb553869aaa4d9Daniel Veillard/** 1319d06d300a5c4146907b3af8fcbf67d8e7d868567Daniel Veillard * initdocbDefaultSAXHandler: 132cbaf399537a1fb69ef97b079e4cb553869aaa4d9Daniel Veillard * @hdlr: the SAX handler 133cbaf399537a1fb69ef97b079e4cb553869aaa4d9Daniel Veillard * 1341af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard * Initialize the default DocBook SAX version 1 handler 1351af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard * DEPRECATED: use xmlSAX2InitDocbDefaultSAXHandler() for the new SAX2 blocks 136cbaf399537a1fb69ef97b079e4cb553869aaa4d9Daniel Veillard */ 137d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillardvoid 138092643b52d29e6b721c257c4c88efa8259eebfe9Daniel VeillardinitdocbDefaultSAXHandler(xmlSAXHandlerV1 *hdlr) 139d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard{ 140d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard if(hdlr->initialized == 1) 141d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard return; 142d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard 1431af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->internalSubset = xmlSAX2InternalSubset; 144d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->externalSubset = NULL; 1451af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->isStandalone = xmlSAX2IsStandalone; 1461af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->hasInternalSubset = xmlSAX2HasInternalSubset; 1471af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->hasExternalSubset = xmlSAX2HasExternalSubset; 1481af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->resolveEntity = xmlSAX2ResolveEntity; 1491af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->getEntity = xmlSAX2GetEntity; 150d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->getParameterEntity = NULL; 1511af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->entityDecl = xmlSAX2EntityDecl; 152d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->attributeDecl = NULL; 153d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->elementDecl = NULL; 154d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->notationDecl = NULL; 155d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->unparsedEntityDecl = NULL; 1561af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator; 1571af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->startDocument = xmlSAX2StartDocument; 1581af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->endDocument = xmlSAX2EndDocument; 1591af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->startElement = xmlSAX2StartElement; 1601af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->endElement = xmlSAX2EndElement; 1611af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->reference = xmlSAX2Reference; 1621af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->characters = xmlSAX2Characters; 163d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->cdataBlock = NULL; 1641af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace; 165d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->processingInstruction = NULL; 1661af9a41f24deb04ababc4075de0005bd75f320f6Daniel Veillard hdlr->comment = xmlSAX2Comment; 167d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->warning = xmlParserWarning; 168d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->error = xmlParserError; 169d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->fatalError = xmlParserError; 170d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard 171d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard hdlr->initialized = 1; 172d0463560300f1d8b3e41d70c3728ed84fdc8dd30Daniel Veillard} 1733473f88a7abdf4e585e267288fb77e898c580d2bOwen Taylor 174eae522a0d8aa9f830d2e447f29b504030dbb6bbdDaniel Veillard#endif /* LIBXML_DOCB_ENABLED */ 17521e4ef20f64ebd740ebac0ead5d85a5631d2db5eWilliam M. Brack 17621e4ef20f64ebd740ebac0ead5d85a5631d2db5eWilliam M. Brack#endif /* LIBXML_SAX1_ENABLED */ 17721e4ef20f64ebd740ebac0ead5d85a5631d2db5eWilliam M. Brack 1785d4644ef6e38479a648615eca758c5e962a141d5Daniel Veillard#define bottom_SAX 1795d4644ef6e38479a648615eca758c5e962a141d5Daniel Veillard#include "elfgcchack.h" 18021e4ef20f64ebd740ebac0ead5d85a5631d2db5eWilliam M. Brack#endif /* LIBXML_LEGACY_ENABLED */ 181