Line | Count | Source (jump to first uncovered 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/globals.h> |
29 | | #include <libxml/SAX2.h> |
30 | | |
31 | | #ifdef LIBXML_LEGACY_ENABLED |
32 | | #ifdef LIBXML_SAX1_ENABLED |
33 | | /** |
34 | | * initxmlDefaultSAXHandler: |
35 | | * @hdlr: the SAX handler |
36 | | * @warning: flag if non-zero sets the handler warning procedure |
37 | | * |
38 | | * Initialize the default XML SAX version 1 handler |
39 | | * DEPRECATED: use xmlSAX2InitDefaultSAXHandler() for the new SAX2 blocks |
40 | | */ |
41 | | void |
42 | | initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning) |
43 | 0 | { |
44 | |
|
45 | 0 | if(hdlr->initialized == 1) |
46 | 0 | return; |
47 | | |
48 | 0 | hdlr->internalSubset = xmlSAX2InternalSubset; |
49 | 0 | hdlr->externalSubset = xmlSAX2ExternalSubset; |
50 | 0 | hdlr->isStandalone = xmlSAX2IsStandalone; |
51 | 0 | hdlr->hasInternalSubset = xmlSAX2HasInternalSubset; |
52 | 0 | hdlr->hasExternalSubset = xmlSAX2HasExternalSubset; |
53 | 0 | hdlr->resolveEntity = xmlSAX2ResolveEntity; |
54 | 0 | hdlr->getEntity = xmlSAX2GetEntity; |
55 | 0 | hdlr->getParameterEntity = xmlSAX2GetParameterEntity; |
56 | 0 | hdlr->entityDecl = xmlSAX2EntityDecl; |
57 | 0 | hdlr->attributeDecl = xmlSAX2AttributeDecl; |
58 | 0 | hdlr->elementDecl = xmlSAX2ElementDecl; |
59 | 0 | hdlr->notationDecl = xmlSAX2NotationDecl; |
60 | 0 | hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl; |
61 | 0 | hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator; |
62 | 0 | hdlr->startDocument = xmlSAX2StartDocument; |
63 | 0 | hdlr->endDocument = xmlSAX2EndDocument; |
64 | 0 | hdlr->startElement = xmlSAX2StartElement; |
65 | 0 | hdlr->endElement = xmlSAX2EndElement; |
66 | 0 | hdlr->reference = xmlSAX2Reference; |
67 | 0 | hdlr->characters = xmlSAX2Characters; |
68 | 0 | hdlr->cdataBlock = xmlSAX2CDataBlock; |
69 | 0 | hdlr->ignorableWhitespace = xmlSAX2Characters; |
70 | 0 | hdlr->processingInstruction = xmlSAX2ProcessingInstruction; |
71 | 0 | if (warning == 0) |
72 | 0 | hdlr->warning = NULL; |
73 | 0 | else |
74 | 0 | hdlr->warning = xmlParserWarning; |
75 | 0 | hdlr->error = xmlParserError; |
76 | 0 | hdlr->fatalError = xmlParserError; |
77 | |
|
78 | 0 | hdlr->initialized = 1; |
79 | 0 | } |
80 | | |
81 | | #ifdef LIBXML_HTML_ENABLED |
82 | | |
83 | | /** |
84 | | * inithtmlDefaultSAXHandler: |
85 | | * @hdlr: the SAX handler |
86 | | * |
87 | | * Initialize the default HTML SAX version 1 handler |
88 | | * DEPRECATED: use xmlSAX2InitHtmlDefaultSAXHandler() for the new SAX2 blocks |
89 | | */ |
90 | | void |
91 | | inithtmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr) |
92 | 0 | { |
93 | 0 | if(hdlr->initialized == 1) |
94 | 0 | return; |
95 | | |
96 | 0 | hdlr->internalSubset = xmlSAX2InternalSubset; |
97 | 0 | hdlr->externalSubset = NULL; |
98 | 0 | hdlr->isStandalone = NULL; |
99 | 0 | hdlr->hasInternalSubset = NULL; |
100 | 0 | hdlr->hasExternalSubset = NULL; |
101 | 0 | hdlr->resolveEntity = NULL; |
102 | 0 | hdlr->getEntity = xmlSAX2GetEntity; |
103 | 0 | hdlr->getParameterEntity = NULL; |
104 | 0 | hdlr->entityDecl = NULL; |
105 | 0 | hdlr->attributeDecl = NULL; |
106 | 0 | hdlr->elementDecl = NULL; |
107 | 0 | hdlr->notationDecl = NULL; |
108 | 0 | hdlr->unparsedEntityDecl = NULL; |
109 | 0 | hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator; |
110 | 0 | hdlr->startDocument = xmlSAX2StartDocument; |
111 | 0 | hdlr->endDocument = xmlSAX2EndDocument; |
112 | 0 | hdlr->startElement = xmlSAX2StartElement; |
113 | 0 | hdlr->endElement = xmlSAX2EndElement; |
114 | 0 | hdlr->reference = NULL; |
115 | 0 | hdlr->characters = xmlSAX2Characters; |
116 | 0 | hdlr->cdataBlock = xmlSAX2CDataBlock; |
117 | 0 | hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace; |
118 | 0 | hdlr->processingInstruction = xmlSAX2ProcessingInstruction; |
119 | 0 | hdlr->comment = xmlSAX2Comment; |
120 | 0 | hdlr->warning = xmlParserWarning; |
121 | 0 | hdlr->error = xmlParserError; |
122 | 0 | hdlr->fatalError = xmlParserError; |
123 | |
|
124 | 0 | hdlr->initialized = 1; |
125 | 0 | } |
126 | | |
127 | | #endif /* LIBXML_HTML_ENABLED */ |
128 | | |
129 | | #ifdef LIBXML_DOCB_ENABLED |
130 | | /** |
131 | | * initdocbDefaultSAXHandler: |
132 | | * @hdlr: the SAX handler |
133 | | * |
134 | | * Initialize the default DocBook SAX version 1 handler |
135 | | * DEPRECATED: use xmlSAX2InitDocbDefaultSAXHandler() for the new SAX2 blocks |
136 | | */ |
137 | | void |
138 | | initdocbDefaultSAXHandler(xmlSAXHandlerV1 *hdlr) |
139 | 0 | { |
140 | 0 | if(hdlr->initialized == 1) |
141 | 0 | return; |
142 | | |
143 | 0 | hdlr->internalSubset = xmlSAX2InternalSubset; |
144 | 0 | hdlr->externalSubset = NULL; |
145 | 0 | hdlr->isStandalone = xmlSAX2IsStandalone; |
146 | 0 | hdlr->hasInternalSubset = xmlSAX2HasInternalSubset; |
147 | 0 | hdlr->hasExternalSubset = xmlSAX2HasExternalSubset; |
148 | 0 | hdlr->resolveEntity = xmlSAX2ResolveEntity; |
149 | 0 | hdlr->getEntity = xmlSAX2GetEntity; |
150 | 0 | hdlr->getParameterEntity = NULL; |
151 | 0 | hdlr->entityDecl = xmlSAX2EntityDecl; |
152 | 0 | hdlr->attributeDecl = NULL; |
153 | 0 | hdlr->elementDecl = NULL; |
154 | 0 | hdlr->notationDecl = NULL; |
155 | 0 | hdlr->unparsedEntityDecl = NULL; |
156 | 0 | hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator; |
157 | 0 | hdlr->startDocument = xmlSAX2StartDocument; |
158 | 0 | hdlr->endDocument = xmlSAX2EndDocument; |
159 | 0 | hdlr->startElement = xmlSAX2StartElement; |
160 | 0 | hdlr->endElement = xmlSAX2EndElement; |
161 | 0 | hdlr->reference = xmlSAX2Reference; |
162 | 0 | hdlr->characters = xmlSAX2Characters; |
163 | 0 | hdlr->cdataBlock = NULL; |
164 | 0 | hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace; |
165 | 0 | hdlr->processingInstruction = NULL; |
166 | 0 | hdlr->comment = xmlSAX2Comment; |
167 | 0 | hdlr->warning = xmlParserWarning; |
168 | 0 | hdlr->error = xmlParserError; |
169 | 0 | hdlr->fatalError = xmlParserError; |
170 | |
|
171 | 0 | hdlr->initialized = 1; |
172 | 0 | } |
173 | | |
174 | | #endif /* LIBXML_DOCB_ENABLED */ |
175 | | |
176 | | #endif /* LIBXML_SAX1_ENABLED */ |
177 | | |
178 | | #define bottom_SAX |
179 | | #include "elfgcchack.h" |
180 | | #endif /* LIBXML_LEGACY_ENABLED */ |