blob: ad7d6efffeb70e82a21ed740b0353e137d7225b4 [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
Daniel Veillard1af9a412003-08-20 22:54:39 +00002 * SAX.c : Old SAX v1 handlers to build a tree.
3 * Deprecated except for compatibility
Owen Taylor3473f882001-02-23 17:55:21 +00004 *
5 * See Copyright for the status of this software.
6 *
Daniel Veillardc5d64342001-06-24 12:13:24 +00007 * Daniel Veillard <daniel@veillard.com>
Owen Taylor3473f882001-02-23 17:55:21 +00008 */
9
10
Daniel Veillard34ce8be2002-03-18 19:37:11 +000011#define IN_LIBXML
Bjorn Reese70a9da52001-04-21 16:57:29 +000012#include "libxml.h"
Owen Taylor3473f882001-02-23 17:55:21 +000013#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>
Daniel Veillard48da9102001-08-07 01:10:10 +000026#include <libxml/valid.h>
Owen Taylor3473f882001-02-23 17:55:21 +000027#include <libxml/HTMLtree.h>
Daniel Veillard3c01b1d2001-10-17 15:58:35 +000028#include <libxml/globals.h>
Daniel Veillard1af9a412003-08-20 22:54:39 +000029#include <libxml/SAX2.h>
Owen Taylor3473f882001-02-23 17:55:21 +000030
31/* #define DEBUG_SAX */
32/* #define DEBUG_SAX_TREE */
33
Daniel Veillard11af4292003-08-21 10:39:13 +000034static int deprecated_msg = 0;
35
36#define DEPRECATED(n) \
37 if (deprecated_msg == 0) \
38 xmlGenericError(xmlGenericErrorContext, \
39 "Use of deprecated SAXv1 function %s\n", n); \
40 deprecated_msg++;
41
Owen Taylor3473f882001-02-23 17:55:21 +000042/**
43 * getPublicId:
44 * @ctx: the user data (XML parser context)
45 *
Daniel Veillarda9b66d02002-12-11 14:23:49 +000046 * Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN"
Daniel Veillard1af9a412003-08-20 22:54:39 +000047 * DEPRECATED: use xmlSAX2GetPublicId()
Owen Taylor3473f882001-02-23 17:55:21 +000048 *
49 * Returns a xmlChar *
50 */
51const xmlChar *
Daniel Veillard1af9a412003-08-20 22:54:39 +000052getPublicId(void *ctx)
Owen Taylor3473f882001-02-23 17:55:21 +000053{
Daniel Veillard11af4292003-08-21 10:39:13 +000054 DEPRECATED("getPublicId")
Daniel Veillard1af9a412003-08-20 22:54:39 +000055 return(xmlSAX2GetPublicId(ctx));
Owen Taylor3473f882001-02-23 17:55:21 +000056}
57
58/**
59 * getSystemId:
60 * @ctx: the user data (XML parser context)
61 *
Daniel Veillarda9b66d02002-12-11 14:23:49 +000062 * Provides the system ID, basically URL or filename e.g.
Owen Taylor3473f882001-02-23 17:55:21 +000063 * http://www.sgmlsource.com/dtds/memo.dtd
Daniel Veillard1af9a412003-08-20 22:54:39 +000064 * DEPRECATED: use xmlSAX2GetSystemId()
Owen Taylor3473f882001-02-23 17:55:21 +000065 *
66 * Returns a xmlChar *
67 */
68const xmlChar *
69getSystemId(void *ctx)
70{
Daniel Veillard11af4292003-08-21 10:39:13 +000071 DEPRECATED("getSystemId")
Daniel Veillard1af9a412003-08-20 22:54:39 +000072 return(xmlSAX2GetSystemId(ctx));
Owen Taylor3473f882001-02-23 17:55:21 +000073}
74
75/**
76 * getLineNumber:
77 * @ctx: the user data (XML parser context)
78 *
Daniel Veillarda9b66d02002-12-11 14:23:49 +000079 * Provide the line number of the current parsing point.
Daniel Veillard1af9a412003-08-20 22:54:39 +000080 * DEPRECATED: use xmlSAX2GetLineNumber()
Owen Taylor3473f882001-02-23 17:55:21 +000081 *
82 * Returns an int
83 */
84int
85getLineNumber(void *ctx)
86{
Daniel Veillard11af4292003-08-21 10:39:13 +000087 DEPRECATED("getLineNumber")
Daniel Veillard1af9a412003-08-20 22:54:39 +000088 return(xmlSAX2GetLineNumber(ctx));
Owen Taylor3473f882001-02-23 17:55:21 +000089}
90
91/**
92 * getColumnNumber:
93 * @ctx: the user data (XML parser context)
94 *
Daniel Veillarda9b66d02002-12-11 14:23:49 +000095 * Provide the column number of the current parsing point.
Daniel Veillard1af9a412003-08-20 22:54:39 +000096 * DEPRECATED: use xmlSAX2GetColumnNumber()
Owen Taylor3473f882001-02-23 17:55:21 +000097 *
98 * Returns an int
99 */
100int
101getColumnNumber(void *ctx)
102{
Daniel Veillard11af4292003-08-21 10:39:13 +0000103 DEPRECATED("getColumnNumber")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000104 return(xmlSAX2GetColumnNumber(ctx));
Owen Taylor3473f882001-02-23 17:55:21 +0000105}
106
Owen Taylor3473f882001-02-23 17:55:21 +0000107/**
108 * isStandalone:
109 * @ctx: the user data (XML parser context)
110 *
111 * Is this document tagged standalone ?
Daniel Veillard1af9a412003-08-20 22:54:39 +0000112 * DEPRECATED: use xmlSAX2IsStandalone()
Owen Taylor3473f882001-02-23 17:55:21 +0000113 *
114 * Returns 1 if true
115 */
116int
117isStandalone(void *ctx)
118{
Daniel Veillard11af4292003-08-21 10:39:13 +0000119 DEPRECATED("isStandalone")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000120 return(xmlSAX2IsStandalone(ctx));
Owen Taylor3473f882001-02-23 17:55:21 +0000121}
122
123/**
124 * hasInternalSubset:
125 * @ctx: the user data (XML parser context)
126 *
127 * Does this document has an internal subset
Daniel Veillard1af9a412003-08-20 22:54:39 +0000128 * DEPRECATED: use xmlSAX2HasInternalSubset()
Owen Taylor3473f882001-02-23 17:55:21 +0000129 *
130 * Returns 1 if true
131 */
132int
133hasInternalSubset(void *ctx)
134{
Daniel Veillard11af4292003-08-21 10:39:13 +0000135 DEPRECATED("hasInternalSubset")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000136 return(xmlSAX2HasInternalSubset(ctx));
Owen Taylor3473f882001-02-23 17:55:21 +0000137}
138
139/**
140 * hasExternalSubset:
141 * @ctx: the user data (XML parser context)
142 *
143 * Does this document has an external subset
Daniel Veillard1af9a412003-08-20 22:54:39 +0000144 * DEPRECATED: use xmlSAX2HasExternalSubset()
Owen Taylor3473f882001-02-23 17:55:21 +0000145 *
146 * Returns 1 if true
147 */
148int
149hasExternalSubset(void *ctx)
150{
Daniel Veillard11af4292003-08-21 10:39:13 +0000151 DEPRECATED("hasExternalSubset")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000152 return(xmlSAX2HasExternalSubset(ctx));
Owen Taylor3473f882001-02-23 17:55:21 +0000153}
154
155/**
156 * internalSubset:
157 * @ctx: the user data (XML parser context)
158 * @name: the root element name
159 * @ExternalID: the external ID
160 * @SystemID: the SYSTEM ID (e.g. filename or URL)
161 *
162 * Callback on internal subset declaration.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000163 * DEPRECATED: use xmlSAX2InternalSubset()
Owen Taylor3473f882001-02-23 17:55:21 +0000164 */
165void
166internalSubset(void *ctx, const xmlChar *name,
167 const xmlChar *ExternalID, const xmlChar *SystemID)
168{
Daniel Veillard11af4292003-08-21 10:39:13 +0000169 DEPRECATED("internalSubset")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000170 xmlSAX2InternalSubset(ctx, name, ExternalID, SystemID);
Owen Taylor3473f882001-02-23 17:55:21 +0000171}
172
173/**
174 * externalSubset:
175 * @ctx: the user data (XML parser context)
176 * @name: the root element name
177 * @ExternalID: the external ID
178 * @SystemID: the SYSTEM ID (e.g. filename or URL)
179 *
180 * Callback on external subset declaration.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000181 * DEPRECATED: use xmlSAX2ExternalSubset()
Owen Taylor3473f882001-02-23 17:55:21 +0000182 */
183void
184externalSubset(void *ctx, const xmlChar *name,
185 const xmlChar *ExternalID, const xmlChar *SystemID)
186{
Daniel Veillard11af4292003-08-21 10:39:13 +0000187 DEPRECATED("externalSubset")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000188 xmlSAX2ExternalSubset(ctx, name, ExternalID, SystemID);
Owen Taylor3473f882001-02-23 17:55:21 +0000189}
190
191/**
192 * resolveEntity:
193 * @ctx: the user data (XML parser context)
194 * @publicId: The public ID of the entity
195 * @systemId: The system ID of the entity
196 *
197 * The entity loader, to control the loading of external entities,
198 * the application can either:
199 * - override this resolveEntity() callback in the SAX block
200 * - or better use the xmlSetExternalEntityLoader() function to
201 * set up it's own entity resolution routine
Daniel Veillard1af9a412003-08-20 22:54:39 +0000202 * DEPRECATED: use xmlSAX2ResolveEntity()
Owen Taylor3473f882001-02-23 17:55:21 +0000203 *
204 * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
205 */
206xmlParserInputPtr
207resolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
208{
Daniel Veillard11af4292003-08-21 10:39:13 +0000209 DEPRECATED("resolveEntity")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000210 return(xmlSAX2ResolveEntity(ctx, publicId, systemId));
Owen Taylor3473f882001-02-23 17:55:21 +0000211}
212
213/**
214 * getEntity:
215 * @ctx: the user data (XML parser context)
216 * @name: The entity name
217 *
218 * Get an entity by name
Daniel Veillard1af9a412003-08-20 22:54:39 +0000219 * DEPRECATED: use xmlSAX2GetEntity()
Owen Taylor3473f882001-02-23 17:55:21 +0000220 *
221 * Returns the xmlEntityPtr if found.
222 */
223xmlEntityPtr
224getEntity(void *ctx, const xmlChar *name)
225{
Daniel Veillard11af4292003-08-21 10:39:13 +0000226 DEPRECATED("getEntity")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000227 return(xmlSAX2GetEntity(ctx, name));
Owen Taylor3473f882001-02-23 17:55:21 +0000228}
229
230/**
231 * getParameterEntity:
232 * @ctx: the user data (XML parser context)
233 * @name: The entity name
234 *
235 * Get a parameter entity by name
Daniel Veillard1af9a412003-08-20 22:54:39 +0000236 * DEPRECATED: use xmlSAX2GetParameterEntity()
Owen Taylor3473f882001-02-23 17:55:21 +0000237 *
238 * Returns the xmlEntityPtr if found.
239 */
240xmlEntityPtr
241getParameterEntity(void *ctx, const xmlChar *name)
242{
Daniel Veillard11af4292003-08-21 10:39:13 +0000243 DEPRECATED("getParameterEntity")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000244 return(xmlSAX2GetParameterEntity(ctx, name));
Owen Taylor3473f882001-02-23 17:55:21 +0000245}
246
247
248/**
249 * entityDecl:
250 * @ctx: the user data (XML parser context)
251 * @name: the entity name
252 * @type: the entity type
253 * @publicId: The public ID of the entity
254 * @systemId: The system ID of the entity
255 * @content: the entity value (without processing).
256 *
257 * An entity definition has been parsed
Daniel Veillard1af9a412003-08-20 22:54:39 +0000258 * DEPRECATED: use xmlSAX2EntityDecl()
Owen Taylor3473f882001-02-23 17:55:21 +0000259 */
260void
261entityDecl(void *ctx, const xmlChar *name, int type,
262 const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
263{
Daniel Veillard11af4292003-08-21 10:39:13 +0000264 DEPRECATED("entityDecl")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000265 xmlSAX2EntityDecl(ctx, name, type, publicId, systemId, content);
Owen Taylor3473f882001-02-23 17:55:21 +0000266}
267
268/**
269 * attributeDecl:
270 * @ctx: the user data (XML parser context)
271 * @elem: the name of the element
272 * @fullname: the attribute name
273 * @type: the attribute type
274 * @def: the type of default value
275 * @defaultValue: the attribute default value
276 * @tree: the tree of enumerated value set
277 *
278 * An attribute definition has been parsed
Daniel Veillard1af9a412003-08-20 22:54:39 +0000279 * DEPRECATED: use xmlSAX2AttributeDecl()
Owen Taylor3473f882001-02-23 17:55:21 +0000280 */
281void
282attributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
283 int type, int def, const xmlChar *defaultValue,
284 xmlEnumerationPtr tree)
285{
Daniel Veillard11af4292003-08-21 10:39:13 +0000286 DEPRECATED("attributeDecl")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000287 xmlSAX2AttributeDecl(ctx, elem, fullname, type, def, defaultValue, tree);
Owen Taylor3473f882001-02-23 17:55:21 +0000288}
289
290/**
291 * elementDecl:
292 * @ctx: the user data (XML parser context)
293 * @name: the element name
294 * @type: the element type
295 * @content: the element value tree
296 *
297 * An element definition has been parsed
Daniel Veillard1af9a412003-08-20 22:54:39 +0000298 * DEPRECATED: use xmlSAX2ElementDecl()
Owen Taylor3473f882001-02-23 17:55:21 +0000299 */
300void
Daniel Veillard1fd36d22001-07-04 22:54:28 +0000301elementDecl(void *ctx, const xmlChar * name, int type,
302 xmlElementContentPtr content)
Owen Taylor3473f882001-02-23 17:55:21 +0000303{
Daniel Veillard11af4292003-08-21 10:39:13 +0000304 DEPRECATED("elementDecl")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000305 xmlSAX2ElementDecl(ctx, name, type, content);
Owen Taylor3473f882001-02-23 17:55:21 +0000306}
307
308/**
309 * notationDecl:
310 * @ctx: the user data (XML parser context)
311 * @name: The name of the notation
312 * @publicId: The public ID of the entity
313 * @systemId: The system ID of the entity
314 *
315 * What to do when a notation declaration has been parsed.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000316 * DEPRECATED: use xmlSAX2NotationDecl()
Owen Taylor3473f882001-02-23 17:55:21 +0000317 */
318void
319notationDecl(void *ctx, const xmlChar *name,
320 const xmlChar *publicId, const xmlChar *systemId)
321{
Daniel Veillard11af4292003-08-21 10:39:13 +0000322 DEPRECATED("notationDecl")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000323 xmlSAX2NotationDecl(ctx, name, publicId, systemId);
Owen Taylor3473f882001-02-23 17:55:21 +0000324}
325
326/**
327 * unparsedEntityDecl:
328 * @ctx: the user data (XML parser context)
329 * @name: The name of the entity
330 * @publicId: The public ID of the entity
331 * @systemId: The system ID of the entity
332 * @notationName: the name of the notation
333 *
334 * What to do when an unparsed entity declaration is parsed
Daniel Veillard1af9a412003-08-20 22:54:39 +0000335 * DEPRECATED: use xmlSAX2UnparsedEntityDecl()
Owen Taylor3473f882001-02-23 17:55:21 +0000336 */
337void
338unparsedEntityDecl(void *ctx, const xmlChar *name,
339 const xmlChar *publicId, const xmlChar *systemId,
340 const xmlChar *notationName)
341{
Daniel Veillard11af4292003-08-21 10:39:13 +0000342 DEPRECATED("unparsedEntityDecl")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000343 xmlSAX2UnparsedEntityDecl(ctx, name, publicId, systemId, notationName);
Owen Taylor3473f882001-02-23 17:55:21 +0000344}
345
346/**
347 * setDocumentLocator:
348 * @ctx: the user data (XML parser context)
349 * @loc: A SAX Locator
350 *
351 * Receive the document locator at startup, actually xmlDefaultSAXLocator
352 * Everything is available on the context, so this is useless in our case.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000353 * DEPRECATED
Owen Taylor3473f882001-02-23 17:55:21 +0000354 */
355void
Daniel Veillardc86a4fa2001-03-26 16:28:29 +0000356setDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
Owen Taylor3473f882001-02-23 17:55:21 +0000357{
Daniel Veillard11af4292003-08-21 10:39:13 +0000358 DEPRECATED("setDocumentLocator")
Owen Taylor3473f882001-02-23 17:55:21 +0000359}
360
361/**
362 * startDocument:
363 * @ctx: the user data (XML parser context)
364 *
365 * called when the document start being processed.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000366 * DEPRECATED: use xmlSAX2StartDocument()
Owen Taylor3473f882001-02-23 17:55:21 +0000367 */
368void
369startDocument(void *ctx)
370{
Daniel Veillard11af4292003-08-21 10:39:13 +0000371 DEPRECATED("startDocument")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000372 xmlSAX2StartDocument(ctx);
Owen Taylor3473f882001-02-23 17:55:21 +0000373}
374
375/**
376 * endDocument:
377 * @ctx: the user data (XML parser context)
378 *
379 * called when the document end has been detected.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000380 * DEPRECATED: use xmlSAX2EndDocument()
Owen Taylor3473f882001-02-23 17:55:21 +0000381 */
382void
383endDocument(void *ctx)
384{
Daniel Veillard11af4292003-08-21 10:39:13 +0000385 DEPRECATED("endDocument")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000386 xmlSAX2EndDocument(ctx);
Owen Taylor3473f882001-02-23 17:55:21 +0000387}
388
Daniel Veillard90d68fb2002-09-26 16:10:21 +0000389/**
390 * attribute:
391 * @ctx: the user data (XML parser context)
392 * @fullname: The attribute name, including namespace prefix
393 * @value: The attribute value
394 *
395 * Handle an attribute that has been read by the parser.
396 * The default handling is to convert the attribute into an
397 * DOM subtree and past it in a new xmlAttr element added to
398 * the element.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000399 * DEPRECATED: use xmlSAX2Attribute()
Daniel Veillard90d68fb2002-09-26 16:10:21 +0000400 */
401void
Daniel Veillard1af9a412003-08-20 22:54:39 +0000402attribute(void *ctx ATTRIBUTE_UNUSED, const xmlChar *fullname ATTRIBUTE_UNUSED, const xmlChar *value ATTRIBUTE_UNUSED)
Daniel Veillard90d68fb2002-09-26 16:10:21 +0000403{
Daniel Veillard11af4292003-08-21 10:39:13 +0000404 DEPRECATED("attribute")
Daniel Veillard878eab02002-02-19 13:46:09 +0000405}
406
Owen Taylor3473f882001-02-23 17:55:21 +0000407/**
408 * startElement:
409 * @ctx: the user data (XML parser context)
410 * @fullname: The element name, including namespace prefix
411 * @atts: An array of name/value attributes pairs, NULL terminated
412 *
413 * called when an opening tag has been processed.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000414 * DEPRECATED: use xmlSAX2StartElement()
Owen Taylor3473f882001-02-23 17:55:21 +0000415 */
416void
417startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
418{
Daniel Veillard11af4292003-08-21 10:39:13 +0000419 DEPRECATED("startElement")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000420 xmlSAX2StartElement(ctx, fullname, atts);
Owen Taylor3473f882001-02-23 17:55:21 +0000421}
422
423/**
424 * endElement:
425 * @ctx: the user data (XML parser context)
426 * @name: The element name
427 *
428 * called when the end of an element has been detected.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000429 * DEPRECATED: use xmlSAX2EndElement()
Owen Taylor3473f882001-02-23 17:55:21 +0000430 */
431void
Daniel Veillardc86a4fa2001-03-26 16:28:29 +0000432endElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
Owen Taylor3473f882001-02-23 17:55:21 +0000433{
Daniel Veillard11af4292003-08-21 10:39:13 +0000434 DEPRECATED("endElement")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000435 xmlSAX2EndElement(ctx, name);
Owen Taylor3473f882001-02-23 17:55:21 +0000436}
437
438/**
439 * reference:
440 * @ctx: the user data (XML parser context)
441 * @name: The entity name
442 *
443 * called when an entity reference is detected.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000444 * DEPRECATED: use xmlSAX2Reference()
Owen Taylor3473f882001-02-23 17:55:21 +0000445 */
446void
447reference(void *ctx, const xmlChar *name)
448{
Daniel Veillard11af4292003-08-21 10:39:13 +0000449 DEPRECATED("reference")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000450 xmlSAX2Reference(ctx, name);
Owen Taylor3473f882001-02-23 17:55:21 +0000451}
452
453/**
454 * characters:
455 * @ctx: the user data (XML parser context)
456 * @ch: a xmlChar string
457 * @len: the number of xmlChar
458 *
459 * receiving some chars from the parser.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000460 * DEPRECATED: use xmlSAX2Characters()
Owen Taylor3473f882001-02-23 17:55:21 +0000461 */
462void
463characters(void *ctx, const xmlChar *ch, int len)
464{
Daniel Veillard11af4292003-08-21 10:39:13 +0000465 DEPRECATED("characters")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000466 xmlSAX2Characters(ctx, ch, len);
Owen Taylor3473f882001-02-23 17:55:21 +0000467}
468
469/**
470 * ignorableWhitespace:
471 * @ctx: the user data (XML parser context)
472 * @ch: a xmlChar string
473 * @len: the number of xmlChar
474 *
475 * receiving some ignorable whitespaces from the parser.
Daniel Veillard05c13a22001-09-09 08:38:09 +0000476 * UNUSED: by default the DOM building will use characters
Daniel Veillard1af9a412003-08-20 22:54:39 +0000477 * DEPRECATED: use xmlSAX2IgnorableWhitespace()
Owen Taylor3473f882001-02-23 17:55:21 +0000478 */
479void
Daniel Veillardc86a4fa2001-03-26 16:28:29 +0000480ignorableWhitespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED)
Owen Taylor3473f882001-02-23 17:55:21 +0000481{
Daniel Veillard11af4292003-08-21 10:39:13 +0000482 DEPRECATED("ignorableWhitespace")
Owen Taylor3473f882001-02-23 17:55:21 +0000483}
484
485/**
486 * processingInstruction:
487 * @ctx: the user data (XML parser context)
488 * @target: the target name
489 * @data: the PI data's
490 *
491 * A processing instruction has been parsed.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000492 * DEPRECATED: use xmlSAX2ProcessingInstruction()
Owen Taylor3473f882001-02-23 17:55:21 +0000493 */
494void
495processingInstruction(void *ctx, const xmlChar *target,
496 const xmlChar *data)
497{
Daniel Veillard11af4292003-08-21 10:39:13 +0000498 DEPRECATED("processingInstruction")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000499 xmlSAX2ProcessingInstruction(ctx, target, data);
Owen Taylor3473f882001-02-23 17:55:21 +0000500}
501
502/**
503 * globalNamespace:
504 * @ctx: the user data (XML parser context)
505 * @href: the namespace associated URN
506 * @prefix: the namespace prefix
507 *
508 * An old global namespace has been parsed.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000509 * DEPRECATED
Owen Taylor3473f882001-02-23 17:55:21 +0000510 */
511void
Daniel Veillard1af9a412003-08-20 22:54:39 +0000512globalNamespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *href ATTRIBUTE_UNUSED, const xmlChar *prefix ATTRIBUTE_UNUSED)
Owen Taylor3473f882001-02-23 17:55:21 +0000513{
Daniel Veillard11af4292003-08-21 10:39:13 +0000514 DEPRECATED("globalNamespace")
Owen Taylor3473f882001-02-23 17:55:21 +0000515}
516
517/**
518 * setNamespace:
519 * @ctx: the user data (XML parser context)
520 * @name: the namespace prefix
521 *
522 * Set the current element namespace.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000523 * DEPRECATED
Owen Taylor3473f882001-02-23 17:55:21 +0000524 */
525
526void
Daniel Veillard1af9a412003-08-20 22:54:39 +0000527setNamespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name ATTRIBUTE_UNUSED)
Owen Taylor3473f882001-02-23 17:55:21 +0000528{
Daniel Veillard11af4292003-08-21 10:39:13 +0000529 DEPRECATED("setNamespace")
Owen Taylor3473f882001-02-23 17:55:21 +0000530}
531
532/**
533 * getNamespace:
534 * @ctx: the user data (XML parser context)
535 *
536 * Get the current element namespace.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000537 * DEPRECATED
Owen Taylor3473f882001-02-23 17:55:21 +0000538 *
539 * Returns the xmlNsPtr or NULL if none
540 */
541
542xmlNsPtr
Daniel Veillard1af9a412003-08-20 22:54:39 +0000543getNamespace(void *ctx ATTRIBUTE_UNUSED)
Owen Taylor3473f882001-02-23 17:55:21 +0000544{
Daniel Veillard11af4292003-08-21 10:39:13 +0000545 DEPRECATED("getNamespace")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000546 return(NULL);
Owen Taylor3473f882001-02-23 17:55:21 +0000547}
548
549/**
550 * checkNamespace:
551 * @ctx: the user data (XML parser context)
552 * @namespace: the namespace to check against
553 *
554 * Check that the current element namespace is the same as the
555 * one read upon parsing.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000556 * DEPRECATED
Owen Taylor3473f882001-02-23 17:55:21 +0000557 *
558 * Returns 1 if true 0 otherwise
559 */
560
561int
Daniel Veillard1af9a412003-08-20 22:54:39 +0000562checkNamespace(void *ctx ATTRIBUTE_UNUSED, xmlChar *namespace ATTRIBUTE_UNUSED)
Owen Taylor3473f882001-02-23 17:55:21 +0000563{
Daniel Veillard11af4292003-08-21 10:39:13 +0000564 DEPRECATED("checkNamespace")
Owen Taylor3473f882001-02-23 17:55:21 +0000565 return(0);
566}
567
568/**
569 * namespaceDecl:
570 * @ctx: the user data (XML parser context)
571 * @href: the namespace associated URN
572 * @prefix: the namespace prefix
573 *
574 * A namespace has been parsed.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000575 * DEPRECATED
Owen Taylor3473f882001-02-23 17:55:21 +0000576 */
577void
Daniel Veillard1af9a412003-08-20 22:54:39 +0000578namespaceDecl(void *ctx ATTRIBUTE_UNUSED, const xmlChar *href ATTRIBUTE_UNUSED, const xmlChar *prefix ATTRIBUTE_UNUSED)
Owen Taylor3473f882001-02-23 17:55:21 +0000579{
Daniel Veillard11af4292003-08-21 10:39:13 +0000580 DEPRECATED("namespaceDecl")
Owen Taylor3473f882001-02-23 17:55:21 +0000581}
582
583/**
584 * comment:
585 * @ctx: the user data (XML parser context)
586 * @value: the comment content
587 *
588 * A comment has been parsed.
Daniel Veillard1af9a412003-08-20 22:54:39 +0000589 * DEPRECATED: use xmlSAX2Comment()
Owen Taylor3473f882001-02-23 17:55:21 +0000590 */
591void
592comment(void *ctx, const xmlChar *value)
593{
Daniel Veillard11af4292003-08-21 10:39:13 +0000594 DEPRECATED("comment")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000595 xmlSAX2Comment(ctx, value);
Owen Taylor3473f882001-02-23 17:55:21 +0000596}
597
598/**
599 * cdataBlock:
600 * @ctx: the user data (XML parser context)
601 * @value: The pcdata content
602 * @len: the block length
603 *
604 * called when a pcdata block has been parsed
Daniel Veillard1af9a412003-08-20 22:54:39 +0000605 * DEPRECATED: use xmlSAX2CDataBlock()
Owen Taylor3473f882001-02-23 17:55:21 +0000606 */
607void
608cdataBlock(void *ctx, const xmlChar *value, int len)
609{
Daniel Veillard11af4292003-08-21 10:39:13 +0000610 DEPRECATED("cdataBlock")
Daniel Veillard1af9a412003-08-20 22:54:39 +0000611 xmlSAX2CDataBlock(ctx, value, len);
Owen Taylor3473f882001-02-23 17:55:21 +0000612}
613
Daniel Veillardd0463562001-10-13 09:15:48 +0000614/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000615 * initxmlDefaultSAXHandler:
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000616 * @hdlr: the SAX handler
617 * @warning: flag if non-zero sets the handler warning procedure
Daniel Veillardd0463562001-10-13 09:15:48 +0000618 *
Daniel Veillard1af9a412003-08-20 22:54:39 +0000619 * Initialize the default XML SAX version 1 handler
620 * DEPRECATED: use xmlSAX2InitDefaultSAXHandler() for the new SAX2 blocks
Owen Taylor3473f882001-02-23 17:55:21 +0000621 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000622void
623initxmlDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
624{
Daniel Veillard1af9a412003-08-20 22:54:39 +0000625
Daniel Veillardd0463562001-10-13 09:15:48 +0000626 if(hdlr->initialized == 1)
627 return;
628
Daniel Veillard1af9a412003-08-20 22:54:39 +0000629 hdlr->internalSubset = xmlSAX2InternalSubset;
630 hdlr->externalSubset = xmlSAX2ExternalSubset;
631 hdlr->isStandalone = xmlSAX2IsStandalone;
632 hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
633 hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
634 hdlr->resolveEntity = xmlSAX2ResolveEntity;
635 hdlr->getEntity = xmlSAX2GetEntity;
636 hdlr->getParameterEntity = xmlSAX2GetParameterEntity;
637 hdlr->entityDecl = xmlSAX2EntityDecl;
638 hdlr->attributeDecl = xmlSAX2AttributeDecl;
639 hdlr->elementDecl = xmlSAX2ElementDecl;
640 hdlr->notationDecl = xmlSAX2NotationDecl;
641 hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl;
642 hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
643 hdlr->startDocument = xmlSAX2StartDocument;
644 hdlr->endDocument = xmlSAX2EndDocument;
645 hdlr->startElement = xmlSAX2StartElement;
646 hdlr->endElement = xmlSAX2EndElement;
647 hdlr->reference = xmlSAX2Reference;
648 hdlr->characters = xmlSAX2Characters;
649 hdlr->cdataBlock = xmlSAX2CDataBlock;
650 hdlr->ignorableWhitespace = xmlSAX2Characters;
651 hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
Daniel Veillardd0463562001-10-13 09:15:48 +0000652 if (warning == 0)
653 hdlr->warning = NULL;
654 else
655 hdlr->warning = xmlParserWarning;
656 hdlr->error = xmlParserError;
657 hdlr->fatalError = xmlParserError;
658
659 hdlr->initialized = 1;
660}
Owen Taylor3473f882001-02-23 17:55:21 +0000661
Daniel Veillardeae522a2001-04-23 13:41:34 +0000662#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd0463562001-10-13 09:15:48 +0000663
664/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000665 * inithtmlDefaultSAXHandler:
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000666 * @hdlr: the SAX handler
Daniel Veillardd0463562001-10-13 09:15:48 +0000667 *
Daniel Veillard1af9a412003-08-20 22:54:39 +0000668 * Initialize the default HTML SAX version 1 handler
669 * DEPRECATED: use xmlSAX2InitHtmlDefaultSAXHandler() for the new SAX2 blocks
Owen Taylor3473f882001-02-23 17:55:21 +0000670 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000671void
672inithtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
673{
674 if(hdlr->initialized == 1)
675 return;
676
Daniel Veillard1af9a412003-08-20 22:54:39 +0000677 hdlr->internalSubset = xmlSAX2InternalSubset;
Daniel Veillardd0463562001-10-13 09:15:48 +0000678 hdlr->externalSubset = NULL;
679 hdlr->isStandalone = NULL;
680 hdlr->hasInternalSubset = NULL;
681 hdlr->hasExternalSubset = NULL;
682 hdlr->resolveEntity = NULL;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000683 hdlr->getEntity = xmlSAX2GetEntity;
Daniel Veillardd0463562001-10-13 09:15:48 +0000684 hdlr->getParameterEntity = NULL;
685 hdlr->entityDecl = NULL;
686 hdlr->attributeDecl = NULL;
687 hdlr->elementDecl = NULL;
688 hdlr->notationDecl = NULL;
689 hdlr->unparsedEntityDecl = NULL;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000690 hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
691 hdlr->startDocument = xmlSAX2StartDocument;
692 hdlr->endDocument = xmlSAX2EndDocument;
693 hdlr->startElement = xmlSAX2StartElement;
694 hdlr->endElement = xmlSAX2EndElement;
Daniel Veillardd0463562001-10-13 09:15:48 +0000695 hdlr->reference = NULL;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000696 hdlr->characters = xmlSAX2Characters;
697 hdlr->cdataBlock = xmlSAX2CDataBlock;
698 hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
Daniel Veillardd0463562001-10-13 09:15:48 +0000699 hdlr->processingInstruction = NULL;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000700 hdlr->comment = xmlSAX2Comment;
Daniel Veillardd0463562001-10-13 09:15:48 +0000701 hdlr->warning = xmlParserWarning;
702 hdlr->error = xmlParserError;
703 hdlr->fatalError = xmlParserError;
704
705 hdlr->initialized = 1;
706}
Owen Taylor3473f882001-02-23 17:55:21 +0000707
Daniel Veillardeae522a2001-04-23 13:41:34 +0000708#endif /* LIBXML_HTML_ENABLED */
Owen Taylor3473f882001-02-23 17:55:21 +0000709
Daniel Veillardeae522a2001-04-23 13:41:34 +0000710#ifdef LIBXML_DOCB_ENABLED
Daniel Veillardd0463562001-10-13 09:15:48 +0000711
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000712/**
Daniel Veillard9d06d302002-01-22 18:15:52 +0000713 * initdocbDefaultSAXHandler:
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000714 * @hdlr: the SAX handler
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000715 *
Daniel Veillard1af9a412003-08-20 22:54:39 +0000716 * Initialize the default DocBook SAX version 1 handler
717 * DEPRECATED: use xmlSAX2InitDocbDefaultSAXHandler() for the new SAX2 blocks
Daniel Veillardcbaf3992001-12-31 16:16:02 +0000718 */
Daniel Veillardd0463562001-10-13 09:15:48 +0000719void
720initdocbDefaultSAXHandler(xmlSAXHandler *hdlr)
721{
722 if(hdlr->initialized == 1)
723 return;
724
Daniel Veillard1af9a412003-08-20 22:54:39 +0000725 hdlr->internalSubset = xmlSAX2InternalSubset;
Daniel Veillardd0463562001-10-13 09:15:48 +0000726 hdlr->externalSubset = NULL;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000727 hdlr->isStandalone = xmlSAX2IsStandalone;
728 hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
729 hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
730 hdlr->resolveEntity = xmlSAX2ResolveEntity;
731 hdlr->getEntity = xmlSAX2GetEntity;
Daniel Veillardd0463562001-10-13 09:15:48 +0000732 hdlr->getParameterEntity = NULL;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000733 hdlr->entityDecl = xmlSAX2EntityDecl;
Daniel Veillardd0463562001-10-13 09:15:48 +0000734 hdlr->attributeDecl = NULL;
735 hdlr->elementDecl = NULL;
736 hdlr->notationDecl = NULL;
737 hdlr->unparsedEntityDecl = NULL;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000738 hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
739 hdlr->startDocument = xmlSAX2StartDocument;
740 hdlr->endDocument = xmlSAX2EndDocument;
741 hdlr->startElement = xmlSAX2StartElement;
742 hdlr->endElement = xmlSAX2EndElement;
743 hdlr->reference = xmlSAX2Reference;
744 hdlr->characters = xmlSAX2Characters;
Daniel Veillardd0463562001-10-13 09:15:48 +0000745 hdlr->cdataBlock = NULL;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000746 hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
Daniel Veillardd0463562001-10-13 09:15:48 +0000747 hdlr->processingInstruction = NULL;
Daniel Veillard1af9a412003-08-20 22:54:39 +0000748 hdlr->comment = xmlSAX2Comment;
Daniel Veillardd0463562001-10-13 09:15:48 +0000749 hdlr->warning = xmlParserWarning;
750 hdlr->error = xmlParserError;
751 hdlr->fatalError = xmlParserError;
752
753 hdlr->initialized = 1;
754}
Owen Taylor3473f882001-02-23 17:55:21 +0000755
Daniel Veillardeae522a2001-04-23 13:41:34 +0000756#endif /* LIBXML_DOCB_ENABLED */