VirtualBox

source: vbox/trunk/src/libs/libxml2-2.12.6/SAX.c

Last change on this file was 104106, checked in by vboxsync, 8 weeks ago

libxml2-2.9.14: Applied and adjusted our libxml2 changes to 2.9.14. bugref:10640

  • Property svn:eol-style set to native
File size: 3.8 KB
Line 
1/*
2 * SAX.c : Old SAX v1 handlers to build a tree.
3 * Deprecated except for compatibility
4 *
5 * See Copyright for the status of this software.
6 *
7 * Daniel Veillard <daniel@veillard.com>
8 */
9
10
11#define IN_LIBXML
12#include "libxml.h"
13#include <stdlib.h>
14#include <string.h>
15#include <libxml/xmlmemory.h>
16#include <libxml/tree.h>
17#include <libxml/parser.h>
18#include <libxml/parserInternals.h>
19#include <libxml/valid.h>
20#include <libxml/entities.h>
21#include <libxml/xmlerror.h>
22#include <libxml/debugXML.h>
23#include <libxml/xmlIO.h>
24#include <libxml/SAX.h>
25#include <libxml/uri.h>
26#include <libxml/valid.h>
27#include <libxml/HTMLtree.h>
28#include <libxml/SAX2.h>
29
30#ifdef LIBXML_LEGACY_ENABLED
31#ifdef LIBXML_SAX1_ENABLED
32/**
33 * initxmlDefaultSAXHandler:
34 * @hdlr: the SAX handler
35 * @warning: flag if non-zero sets the handler warning procedure
36 *
37 * Initialize the default XML SAX version 1 handler
38 * DEPRECATED: use xmlSAX2InitDefaultSAXHandler() for the new SAX2 blocks
39 */
40void
41initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning)
42{
43
44 if(hdlr->initialized == 1)
45 return;
46
47 hdlr->internalSubset = xmlSAX2InternalSubset;
48 hdlr->externalSubset = xmlSAX2ExternalSubset;
49 hdlr->isStandalone = xmlSAX2IsStandalone;
50 hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
51 hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
52 hdlr->resolveEntity = xmlSAX2ResolveEntity;
53 hdlr->getEntity = xmlSAX2GetEntity;
54 hdlr->getParameterEntity = xmlSAX2GetParameterEntity;
55 hdlr->entityDecl = xmlSAX2EntityDecl;
56 hdlr->attributeDecl = xmlSAX2AttributeDecl;
57 hdlr->elementDecl = xmlSAX2ElementDecl;
58 hdlr->notationDecl = xmlSAX2NotationDecl;
59 hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl;
60 hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
61 hdlr->startDocument = xmlSAX2StartDocument;
62 hdlr->endDocument = xmlSAX2EndDocument;
63 hdlr->startElement = xmlSAX2StartElement;
64 hdlr->endElement = xmlSAX2EndElement;
65 hdlr->reference = xmlSAX2Reference;
66 hdlr->characters = xmlSAX2Characters;
67 hdlr->cdataBlock = xmlSAX2CDataBlock;
68 hdlr->ignorableWhitespace = xmlSAX2Characters;
69 hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
70 if (warning == 0)
71 hdlr->warning = NULL;
72 else
73 hdlr->warning = xmlParserWarning;
74 hdlr->error = xmlParserError;
75 hdlr->fatalError = xmlParserError;
76
77 hdlr->initialized = 1;
78}
79
80#ifdef LIBXML_HTML_ENABLED
81
82/**
83 * inithtmlDefaultSAXHandler:
84 * @hdlr: the SAX handler
85 *
86 * Initialize the default HTML SAX version 1 handler
87 * DEPRECATED: use xmlSAX2InitHtmlDefaultSAXHandler() for the new SAX2 blocks
88 */
89void
90inithtmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
91{
92 if(hdlr->initialized == 1)
93 return;
94
95 hdlr->internalSubset = xmlSAX2InternalSubset;
96 hdlr->externalSubset = NULL;
97 hdlr->isStandalone = NULL;
98 hdlr->hasInternalSubset = NULL;
99 hdlr->hasExternalSubset = NULL;
100 hdlr->resolveEntity = NULL;
101 hdlr->getEntity = xmlSAX2GetEntity;
102 hdlr->getParameterEntity = NULL;
103 hdlr->entityDecl = NULL;
104 hdlr->attributeDecl = NULL;
105 hdlr->elementDecl = NULL;
106 hdlr->notationDecl = NULL;
107 hdlr->unparsedEntityDecl = NULL;
108 hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
109 hdlr->startDocument = xmlSAX2StartDocument;
110 hdlr->endDocument = xmlSAX2EndDocument;
111 hdlr->startElement = xmlSAX2StartElement;
112 hdlr->endElement = xmlSAX2EndElement;
113 hdlr->reference = NULL;
114 hdlr->characters = xmlSAX2Characters;
115 hdlr->cdataBlock = xmlSAX2CDataBlock;
116 hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
117 hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
118 hdlr->comment = xmlSAX2Comment;
119 hdlr->warning = xmlParserWarning;
120 hdlr->error = xmlParserError;
121 hdlr->fatalError = xmlParserError;
122
123 hdlr->initialized = 1;
124}
125
126#endif /* LIBXML_HTML_ENABLED */
127
128#endif /* LIBXML_SAX1_ENABLED */
129
130#endif /* LIBXML_LEGACY_ENABLED */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use