blob: e0f533ebd70e3518294183fe521221c4dd88b8ee [file] [log] [blame]
Daniel Veillard8940fd52003-09-29 09:07:08 +00001/*
2 * legacy.c: set of deprecated routines, not to be used anymore but
3 * kept purely for ABI compatibility
4 *
5 * See Copyright for the status of this software.
6 *
7 * daniel@veillard.com
8 */
9
10#define IN_LIBXML
11#include "libxml.h"
12
Daniel Veillardd3a2e4c2003-09-30 13:38:04 +000013#ifdef LIBXML_LEGACY_ENABLED
14#include <string.h>
15
Daniel Veillard8940fd52003-09-29 09:07:08 +000016#include <libxml/tree.h>
17#include <libxml/entities.h>
18#include <libxml/SAX.h>
19#include <libxml/parserInternals.h>
20
Daniel Veillard8940fd52003-09-29 09:07:08 +000021void xmlUpgradeOldNs(xmlDocPtr doc);
22
23/************************************************************************
24 * *
25 * Deprecated functions kept for compatibility *
26 * *
27 ************************************************************************/
28
Daniel Veillardd3a2e4c2003-09-30 13:38:04 +000029/**
30 * xmlInitializePredefinedEntities:
31 *
32 * Set up the predefined entities.
33 * Deprecated call
34 */
35void xmlInitializePredefinedEntities(void) {
36}
37
38/**
39 * xmlCleanupPredefinedEntities:
40 *
41 * Cleanup up the predefined entities table.
42 * Deprecated call
43 */
44void xmlCleanupPredefinedEntities(void) {
45}
46
Daniel Veillard73b013f2003-09-30 12:36:01 +000047static const char *xmlFeaturesList[] = {
48 "validate",
49 "load subset",
50 "keep blanks",
51 "disable SAX",
52 "fetch external entities",
53 "substitute entities",
54 "gather line info",
55 "user data",
56 "is html",
57 "is standalone",
58 "stop parser",
59 "document",
60 "is well formed",
61 "is valid",
62 "SAX block",
63 "SAX function internalSubset",
64 "SAX function isStandalone",
65 "SAX function hasInternalSubset",
66 "SAX function hasExternalSubset",
67 "SAX function resolveEntity",
68 "SAX function getEntity",
69 "SAX function entityDecl",
70 "SAX function notationDecl",
71 "SAX function attributeDecl",
72 "SAX function elementDecl",
73 "SAX function unparsedEntityDecl",
74 "SAX function setDocumentLocator",
75 "SAX function startDocument",
76 "SAX function endDocument",
77 "SAX function startElement",
78 "SAX function endElement",
79 "SAX function reference",
80 "SAX function characters",
81 "SAX function ignorableWhitespace",
82 "SAX function processingInstruction",
83 "SAX function comment",
84 "SAX function warning",
85 "SAX function error",
86 "SAX function fatalError",
87 "SAX function getParameterEntity",
88 "SAX function cdataBlock",
89 "SAX function externalSubset",
90};
91
92/**
93 * xmlGetFeaturesList:
94 * @len: the length of the features name array (input/output)
95 * @result: an array of string to be filled with the features name.
96 *
97 * Copy at most *@len feature names into the @result array
98 *
99 * Returns -1 in case or error, or the total number of features,
100 * len is updated with the number of strings copied,
101 * strings must not be deallocated
102 */
103int
104xmlGetFeaturesList(int *len, const char **result) {
105 int ret, i;
106
107 ret = sizeof(xmlFeaturesList)/sizeof(xmlFeaturesList[0]);
108 if ((len == NULL) || (result == NULL))
109 return(ret);
110 if ((*len < 0) || (*len >= 1000))
111 return(-1);
112 if (*len > ret)
113 *len = ret;
114 for (i = 0;i < *len;i++)
115 result[i] = xmlFeaturesList[i];
116 return(ret);
117}
118
119/**
120 * xmlGetFeature:
121 * @ctxt: an XML/HTML parser context
122 * @name: the feature name
123 * @result: location to store the result
124 *
125 * Read the current value of one feature of this parser instance
126 *
127 * Returns -1 in case or error, 0 otherwise
128 */
129int
130xmlGetFeature(xmlParserCtxtPtr ctxt, const char *name, void *result) {
131 if ((ctxt == NULL) || (name == NULL) || (result == NULL))
132 return(-1);
133
134 if (!strcmp(name, "validate")) {
135 *((int *) result) = ctxt->validate;
136 } else if (!strcmp(name, "keep blanks")) {
137 *((int *) result) = ctxt->keepBlanks;
138 } else if (!strcmp(name, "disable SAX")) {
139 *((int *) result) = ctxt->disableSAX;
140 } else if (!strcmp(name, "fetch external entities")) {
141 *((int *) result) = ctxt->loadsubset;
142 } else if (!strcmp(name, "substitute entities")) {
143 *((int *) result) = ctxt->replaceEntities;
144 } else if (!strcmp(name, "gather line info")) {
145 *((int *) result) = ctxt->record_info;
146 } else if (!strcmp(name, "user data")) {
147 *((void **)result) = ctxt->userData;
148 } else if (!strcmp(name, "is html")) {
149 *((int *) result) = ctxt->html;
150 } else if (!strcmp(name, "is standalone")) {
151 *((int *) result) = ctxt->standalone;
152 } else if (!strcmp(name, "document")) {
153 *((xmlDocPtr *) result) = ctxt->myDoc;
154 } else if (!strcmp(name, "is well formed")) {
155 *((int *) result) = ctxt->wellFormed;
156 } else if (!strcmp(name, "is valid")) {
157 *((int *) result) = ctxt->valid;
158 } else if (!strcmp(name, "SAX block")) {
159 *((xmlSAXHandlerPtr *) result) = ctxt->sax;
160 } else if (!strcmp(name, "SAX function internalSubset")) {
161 *((internalSubsetSAXFunc *) result) = ctxt->sax->internalSubset;
162 } else if (!strcmp(name, "SAX function isStandalone")) {
163 *((isStandaloneSAXFunc *) result) = ctxt->sax->isStandalone;
164 } else if (!strcmp(name, "SAX function hasInternalSubset")) {
165 *((hasInternalSubsetSAXFunc *) result) = ctxt->sax->hasInternalSubset;
166 } else if (!strcmp(name, "SAX function hasExternalSubset")) {
167 *((hasExternalSubsetSAXFunc *) result) = ctxt->sax->hasExternalSubset;
168 } else if (!strcmp(name, "SAX function resolveEntity")) {
169 *((resolveEntitySAXFunc *) result) = ctxt->sax->resolveEntity;
170 } else if (!strcmp(name, "SAX function getEntity")) {
171 *((getEntitySAXFunc *) result) = ctxt->sax->getEntity;
172 } else if (!strcmp(name, "SAX function entityDecl")) {
173 *((entityDeclSAXFunc *) result) = ctxt->sax->entityDecl;
174 } else if (!strcmp(name, "SAX function notationDecl")) {
175 *((notationDeclSAXFunc *) result) = ctxt->sax->notationDecl;
176 } else if (!strcmp(name, "SAX function attributeDecl")) {
177 *((attributeDeclSAXFunc *) result) = ctxt->sax->attributeDecl;
178 } else if (!strcmp(name, "SAX function elementDecl")) {
179 *((elementDeclSAXFunc *) result) = ctxt->sax->elementDecl;
180 } else if (!strcmp(name, "SAX function unparsedEntityDecl")) {
181 *((unparsedEntityDeclSAXFunc *) result) = ctxt->sax->unparsedEntityDecl;
182 } else if (!strcmp(name, "SAX function setDocumentLocator")) {
183 *((setDocumentLocatorSAXFunc *) result) = ctxt->sax->setDocumentLocator;
184 } else if (!strcmp(name, "SAX function startDocument")) {
185 *((startDocumentSAXFunc *) result) = ctxt->sax->startDocument;
186 } else if (!strcmp(name, "SAX function endDocument")) {
187 *((endDocumentSAXFunc *) result) = ctxt->sax->endDocument;
188 } else if (!strcmp(name, "SAX function startElement")) {
189 *((startElementSAXFunc *) result) = ctxt->sax->startElement;
190 } else if (!strcmp(name, "SAX function endElement")) {
191 *((endElementSAXFunc *) result) = ctxt->sax->endElement;
192 } else if (!strcmp(name, "SAX function reference")) {
193 *((referenceSAXFunc *) result) = ctxt->sax->reference;
194 } else if (!strcmp(name, "SAX function characters")) {
195 *((charactersSAXFunc *) result) = ctxt->sax->characters;
196 } else if (!strcmp(name, "SAX function ignorableWhitespace")) {
197 *((ignorableWhitespaceSAXFunc *) result) = ctxt->sax->ignorableWhitespace;
198 } else if (!strcmp(name, "SAX function processingInstruction")) {
199 *((processingInstructionSAXFunc *) result) = ctxt->sax->processingInstruction;
200 } else if (!strcmp(name, "SAX function comment")) {
201 *((commentSAXFunc *) result) = ctxt->sax->comment;
202 } else if (!strcmp(name, "SAX function warning")) {
203 *((warningSAXFunc *) result) = ctxt->sax->warning;
204 } else if (!strcmp(name, "SAX function error")) {
205 *((errorSAXFunc *) result) = ctxt->sax->error;
206 } else if (!strcmp(name, "SAX function fatalError")) {
207 *((fatalErrorSAXFunc *) result) = ctxt->sax->fatalError;
208 } else if (!strcmp(name, "SAX function getParameterEntity")) {
209 *((getParameterEntitySAXFunc *) result) = ctxt->sax->getParameterEntity;
210 } else if (!strcmp(name, "SAX function cdataBlock")) {
211 *((cdataBlockSAXFunc *) result) = ctxt->sax->cdataBlock;
212 } else if (!strcmp(name, "SAX function externalSubset")) {
213 *((externalSubsetSAXFunc *) result) = ctxt->sax->externalSubset;
214 } else {
215 return(-1);
216 }
217 return(0);
218}
219
220/**
221 * xmlSetFeature:
222 * @ctxt: an XML/HTML parser context
223 * @name: the feature name
224 * @value: pointer to the location of the new value
225 *
226 * Change the current value of one feature of this parser instance
227 *
228 * Returns -1 in case or error, 0 otherwise
229 */
230int
231xmlSetFeature(xmlParserCtxtPtr ctxt, const char *name, void *value) {
232 if ((ctxt == NULL) || (name == NULL) || (value == NULL))
233 return(-1);
234
235 if (!strcmp(name, "validate")) {
236 int newvalidate = *((int *) value);
237 if ((!ctxt->validate) && (newvalidate != 0)) {
238 if (ctxt->vctxt.warning == NULL)
239 ctxt->vctxt.warning = xmlParserValidityWarning;
240 if (ctxt->vctxt.error == NULL)
241 ctxt->vctxt.error = xmlParserValidityError;
242 ctxt->vctxt.nodeMax = 0;
243 }
244 ctxt->validate = newvalidate;
245 } else if (!strcmp(name, "keep blanks")) {
246 ctxt->keepBlanks = *((int *) value);
247 } else if (!strcmp(name, "disable SAX")) {
248 ctxt->disableSAX = *((int *) value);
249 } else if (!strcmp(name, "fetch external entities")) {
250 ctxt->loadsubset = *((int *) value);
251 } else if (!strcmp(name, "substitute entities")) {
252 ctxt->replaceEntities = *((int *) value);
253 } else if (!strcmp(name, "gather line info")) {
254 ctxt->record_info = *((int *) value);
255 } else if (!strcmp(name, "user data")) {
256 ctxt->userData = *((void **)value);
257 } else if (!strcmp(name, "is html")) {
258 ctxt->html = *((int *) value);
259 } else if (!strcmp(name, "is standalone")) {
260 ctxt->standalone = *((int *) value);
261 } else if (!strcmp(name, "document")) {
262 ctxt->myDoc = *((xmlDocPtr *) value);
263 } else if (!strcmp(name, "is well formed")) {
264 ctxt->wellFormed = *((int *) value);
265 } else if (!strcmp(name, "is valid")) {
266 ctxt->valid = *((int *) value);
267 } else if (!strcmp(name, "SAX block")) {
268 ctxt->sax = *((xmlSAXHandlerPtr *) value);
269 } else if (!strcmp(name, "SAX function internalSubset")) {
270 ctxt->sax->internalSubset = *((internalSubsetSAXFunc *) value);
271 } else if (!strcmp(name, "SAX function isStandalone")) {
272 ctxt->sax->isStandalone = *((isStandaloneSAXFunc *) value);
273 } else if (!strcmp(name, "SAX function hasInternalSubset")) {
274 ctxt->sax->hasInternalSubset = *((hasInternalSubsetSAXFunc *) value);
275 } else if (!strcmp(name, "SAX function hasExternalSubset")) {
276 ctxt->sax->hasExternalSubset = *((hasExternalSubsetSAXFunc *) value);
277 } else if (!strcmp(name, "SAX function resolveEntity")) {
278 ctxt->sax->resolveEntity = *((resolveEntitySAXFunc *) value);
279 } else if (!strcmp(name, "SAX function getEntity")) {
280 ctxt->sax->getEntity = *((getEntitySAXFunc *) value);
281 } else if (!strcmp(name, "SAX function entityDecl")) {
282 ctxt->sax->entityDecl = *((entityDeclSAXFunc *) value);
283 } else if (!strcmp(name, "SAX function notationDecl")) {
284 ctxt->sax->notationDecl = *((notationDeclSAXFunc *) value);
285 } else if (!strcmp(name, "SAX function attributeDecl")) {
286 ctxt->sax->attributeDecl = *((attributeDeclSAXFunc *) value);
287 } else if (!strcmp(name, "SAX function elementDecl")) {
288 ctxt->sax->elementDecl = *((elementDeclSAXFunc *) value);
289 } else if (!strcmp(name, "SAX function unparsedEntityDecl")) {
290 ctxt->sax->unparsedEntityDecl = *((unparsedEntityDeclSAXFunc *) value);
291 } else if (!strcmp(name, "SAX function setDocumentLocator")) {
292 ctxt->sax->setDocumentLocator = *((setDocumentLocatorSAXFunc *) value);
293 } else if (!strcmp(name, "SAX function startDocument")) {
294 ctxt->sax->startDocument = *((startDocumentSAXFunc *) value);
295 } else if (!strcmp(name, "SAX function endDocument")) {
296 ctxt->sax->endDocument = *((endDocumentSAXFunc *) value);
297 } else if (!strcmp(name, "SAX function startElement")) {
298 ctxt->sax->startElement = *((startElementSAXFunc *) value);
299 } else if (!strcmp(name, "SAX function endElement")) {
300 ctxt->sax->endElement = *((endElementSAXFunc *) value);
301 } else if (!strcmp(name, "SAX function reference")) {
302 ctxt->sax->reference = *((referenceSAXFunc *) value);
303 } else if (!strcmp(name, "SAX function characters")) {
304 ctxt->sax->characters = *((charactersSAXFunc *) value);
305 } else if (!strcmp(name, "SAX function ignorableWhitespace")) {
306 ctxt->sax->ignorableWhitespace = *((ignorableWhitespaceSAXFunc *) value);
307 } else if (!strcmp(name, "SAX function processingInstruction")) {
308 ctxt->sax->processingInstruction = *((processingInstructionSAXFunc *) value);
309 } else if (!strcmp(name, "SAX function comment")) {
310 ctxt->sax->comment = *((commentSAXFunc *) value);
311 } else if (!strcmp(name, "SAX function warning")) {
312 ctxt->sax->warning = *((warningSAXFunc *) value);
313 } else if (!strcmp(name, "SAX function error")) {
314 ctxt->sax->error = *((errorSAXFunc *) value);
315 } else if (!strcmp(name, "SAX function fatalError")) {
316 ctxt->sax->fatalError = *((fatalErrorSAXFunc *) value);
317 } else if (!strcmp(name, "SAX function getParameterEntity")) {
318 ctxt->sax->getParameterEntity = *((getParameterEntitySAXFunc *) value);
319 } else if (!strcmp(name, "SAX function cdataBlock")) {
320 ctxt->sax->cdataBlock = *((cdataBlockSAXFunc *) value);
321 } else if (!strcmp(name, "SAX function externalSubset")) {
322 ctxt->sax->externalSubset = *((externalSubsetSAXFunc *) value);
323 } else {
324 return(-1);
325 }
326 return(0);
327}
328
Daniel Veillard8940fd52003-09-29 09:07:08 +0000329/**
330 * xmlDecodeEntities:
331 * @ctxt: the parser context
332 * @len: the len to decode (in bytes !), -1 for no size limit
333 * @what: combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF
334 * @end: an end marker xmlChar, 0 if none
335 * @end2: an end marker xmlChar, 0 if none
336 * @end3: an end marker xmlChar, 0 if none
337 *
338 * This function is deprecated, we now always process entities content
339 * through xmlStringDecodeEntities
340 *
341 * TODO: remove it in next major release.
342 *
343 * [67] Reference ::= EntityRef | CharRef
344 *
345 * [69] PEReference ::= '%' Name ';'
346 *
347 * Returns A newly allocated string with the substitution done. The caller
348 * must deallocate it !
349 */
350xmlChar *
351xmlDecodeEntities(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
352 int len ATTRIBUTE_UNUSED, int what ATTRIBUTE_UNUSED,
353 xmlChar end ATTRIBUTE_UNUSED,
354 xmlChar end2 ATTRIBUTE_UNUSED,
355 xmlChar end3 ATTRIBUTE_UNUSED)
356{
357 static int deprecated = 0;
358
359 if (!deprecated) {
360 xmlGenericError(xmlGenericErrorContext,
361 "xmlDecodeEntities() deprecated function reached\n");
362 deprecated = 1;
363 }
364 return (NULL);
365}
366
367/**
368 * xmlNamespaceParseNCName:
369 * @ctxt: an XML parser context
370 *
371 * parse an XML namespace name.
372 *
373 * TODO: this seems not in use anymore, the namespace handling is done on
374 * top of the SAX interfaces, i.e. not on raw input.
375 *
376 * [NS 3] NCName ::= (Letter | '_') (NCNameChar)*
377 *
378 * [NS 4] NCNameChar ::= Letter | Digit | '.' | '-' | '_' |
379 * CombiningChar | Extender
380 *
381 * Returns the namespace name or NULL
382 */
383
384xmlChar *
385xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
386{
387 static int deprecated = 0;
388
389 if (!deprecated) {
390 xmlGenericError(xmlGenericErrorContext,
391 "xmlNamespaceParseNCName() deprecated function reached\n");
392 deprecated = 1;
393 }
394 return (NULL);
395}
396
397/**
398 * xmlNamespaceParseQName:
399 * @ctxt: an XML parser context
400 * @prefix: a xmlChar **
401 *
402 * TODO: this seems not in use anymore, the namespace handling is done on
403 * top of the SAX interfaces, i.e. not on raw input.
404 *
405 * parse an XML qualified name
406 *
407 * [NS 5] QName ::= (Prefix ':')? LocalPart
408 *
409 * [NS 6] Prefix ::= NCName
410 *
411 * [NS 7] LocalPart ::= NCName
412 *
413 * Returns the local part, and prefix is updated
414 * to get the Prefix if any.
415 */
416
417xmlChar *
418xmlNamespaceParseQName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
419 xmlChar ** prefix ATTRIBUTE_UNUSED)
420{
421
422 static int deprecated = 0;
423
424 if (!deprecated) {
425 xmlGenericError(xmlGenericErrorContext,
426 "xmlNamespaceParseQName() deprecated function reached\n");
427 deprecated = 1;
428 }
429 return (NULL);
430}
431
432/**
433 * xmlNamespaceParseNSDef:
434 * @ctxt: an XML parser context
435 *
436 * parse a namespace prefix declaration
437 *
438 * TODO: this seems not in use anymore, the namespace handling is done on
439 * top of the SAX interfaces, i.e. not on raw input.
440 *
441 * [NS 1] NSDef ::= PrefixDef Eq SystemLiteral
442 *
443 * [NS 2] PrefixDef ::= 'xmlns' (':' NCName)?
444 *
445 * Returns the namespace name
446 */
447
448xmlChar *
449xmlNamespaceParseNSDef(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
450{
451 static int deprecated = 0;
452
453 if (!deprecated) {
454 xmlGenericError(xmlGenericErrorContext,
455 "xmlNamespaceParseNSDef() deprecated function reached\n");
456 deprecated = 1;
457 }
458 return (NULL);
459}
460
461/**
462 * xmlParseQuotedString:
463 * @ctxt: an XML parser context
464 *
465 * Parse and return a string between quotes or doublequotes
466 *
467 * TODO: Deprecated, to be removed at next drop of binary compatibility
468 *
469 * Returns the string parser or NULL.
470 */
471xmlChar *
472xmlParseQuotedString(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
473{
474 static int deprecated = 0;
475
476 if (!deprecated) {
477 xmlGenericError(xmlGenericErrorContext,
478 "xmlParseQuotedString() deprecated function reached\n");
479 deprecated = 1;
480 }
481 return (NULL);
482}
483
484/**
485 * xmlParseNamespace:
486 * @ctxt: an XML parser context
487 *
488 * xmlParseNamespace: parse specific PI '<?namespace ...' constructs.
489 *
490 * This is what the older xml-name Working Draft specified, a bunch of
491 * other stuff may still rely on it, so support is still here as
492 * if it was declared on the root of the Tree:-(
493 *
494 * TODO: remove from library
495 *
496 * To be removed at next drop of binary compatibility
497 */
498
499void
500xmlParseNamespace(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
501{
502 static int deprecated = 0;
503
504 if (!deprecated) {
505 xmlGenericError(xmlGenericErrorContext,
506 "xmlParseNamespace() deprecated function reached\n");
507 deprecated = 1;
508 }
509}
510
511/**
512 * xmlScanName:
513 * @ctxt: an XML parser context
514 *
515 * Trickery: parse an XML name but without consuming the input flow
516 * Needed for rollback cases. Used only when parsing entities references.
517 *
518 * TODO: seems deprecated now, only used in the default part of
519 * xmlParserHandleReference
520 *
521 * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
522 * CombiningChar | Extender
523 *
524 * [5] Name ::= (Letter | '_' | ':') (NameChar)*
525 *
526 * [6] Names ::= Name (S Name)*
527 *
528 * Returns the Name parsed or NULL
529 */
530
531xmlChar *
532xmlScanName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
533{
534 static int deprecated = 0;
535
536 if (!deprecated) {
537 xmlGenericError(xmlGenericErrorContext,
538 "xmlScanName() deprecated function reached\n");
539 deprecated = 1;
540 }
541 return (NULL);
542}
543
544/**
545 * xmlParserHandleReference:
546 * @ctxt: the parser context
547 *
548 * TODO: Remove, now deprecated ... the test is done directly in the
549 * content parsing
550 * routines.
551 *
552 * [67] Reference ::= EntityRef | CharRef
553 *
554 * [68] EntityRef ::= '&' Name ';'
555 *
556 * [ WFC: Entity Declared ]
557 * the Name given in the entity reference must match that in an entity
558 * declaration, except that well-formed documents need not declare any
559 * of the following entities: amp, lt, gt, apos, quot.
560 *
561 * [ WFC: Parsed Entity ]
562 * An entity reference must not contain the name of an unparsed entity
563 *
564 * [66] CharRef ::= '&#' [0-9]+ ';' |
565 * '&#x' [0-9a-fA-F]+ ';'
566 *
567 * A PEReference may have been detected in the current input stream
568 * the handling is done accordingly to
569 * http://www.w3.org/TR/REC-xml#entproc
570 */
571void
572xmlParserHandleReference(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
573{
574 static int deprecated = 0;
575
576 if (!deprecated) {
577 xmlGenericError(xmlGenericErrorContext,
578 "xmlParserHandleReference() deprecated function reached\n");
579 deprecated = 1;
580 }
581
582 return;
583}
584
585/**
586 * xmlHandleEntity:
587 * @ctxt: an XML parser context
588 * @entity: an XML entity pointer.
589 *
590 * Default handling of defined entities, when should we define a new input
591 * stream ? When do we just handle that as a set of chars ?
592 *
593 * OBSOLETE: to be removed at some point.
594 */
595
596void
597xmlHandleEntity(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
598 xmlEntityPtr entity ATTRIBUTE_UNUSED)
599{
600 static int deprecated = 0;
601
602 if (!deprecated) {
603 xmlGenericError(xmlGenericErrorContext,
604 "xmlHandleEntity() deprecated function reached\n");
605 deprecated = 1;
606 }
607}
608
609/**
610 * xmlNewGlobalNs:
611 * @doc: the document carrying the namespace
612 * @href: the URI associated
613 * @prefix: the prefix for the namespace
614 *
615 * Creation of a Namespace, the old way using PI and without scoping
616 * DEPRECATED !!!
617 * It now create a namespace on the root element of the document if found.
618 * Returns NULL this functionality had been removed
619 */
620xmlNsPtr
621xmlNewGlobalNs(xmlDocPtr doc ATTRIBUTE_UNUSED,
622 const xmlChar * href ATTRIBUTE_UNUSED,
623 const xmlChar * prefix ATTRIBUTE_UNUSED)
624{
625 static int deprecated = 0;
626
627 if (!deprecated) {
628 xmlGenericError(xmlGenericErrorContext,
629 "xmlNewGlobalNs() deprecated function reached\n");
630 deprecated = 1;
631 }
632 return (NULL);
633}
634
635/**
636 * xmlUpgradeOldNs:
637 * @doc: a document pointer
638 *
639 * Upgrade old style Namespaces (PI) and move them to the root of the document.
640 * DEPRECATED
641 */
642void
643xmlUpgradeOldNs(xmlDocPtr doc ATTRIBUTE_UNUSED)
644{
645 static int deprecated = 0;
646
647 if (!deprecated) {
648 xmlGenericError(xmlGenericErrorContext,
649 "xmlUpgradeOldNs() deprecated function reached\n");
650 deprecated = 1;
651 }
652}
653
654/**
655 * xmlEncodeEntities:
656 * @doc: the document containing the string
657 * @input: A string to convert to XML.
658 *
659 * TODO: remove xmlEncodeEntities, once we are not afraid of breaking binary
660 * compatibility
661 *
662 * People must migrate their code to xmlEncodeEntitiesReentrant !
663 * This routine will issue a warning when encountered.
664 *
665 * Returns NULL
666 */
667const xmlChar *
668xmlEncodeEntities(xmlDocPtr doc ATTRIBUTE_UNUSED,
669 const xmlChar *input ATTRIBUTE_UNUSED) {
670 static int warning = 1;
671
672 if (warning) {
673 xmlGenericError(xmlGenericErrorContext,
674 "Deprecated API xmlEncodeEntities() used\n");
675 xmlGenericError(xmlGenericErrorContext,
676 " change code to use xmlEncodeEntitiesReentrant()\n");
677 warning = 0;
678 }
679 return(NULL);
680}
681
682/************************************************************************
683 * *
684 * Old set of SAXv1 functions *
685 * *
686 ************************************************************************/
687static int deprecated_v1_msg = 0;
688
689#define DEPRECATED(n) \
690 if (deprecated_v1_msg == 0) \
691 xmlGenericError(xmlGenericErrorContext, \
692 "Use of deprecated SAXv1 function %s\n", n); \
693 deprecated_v1_msg++;
694
695/**
696 * getPublicId:
697 * @ctx: the user data (XML parser context)
698 *
699 * Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN"
700 * DEPRECATED: use xmlSAX2GetPublicId()
701 *
702 * Returns a xmlChar *
703 */
704const xmlChar *
705getPublicId(void *ctx)
706{
707 DEPRECATED("getPublicId")
708 return(xmlSAX2GetPublicId(ctx));
709}
710
711/**
712 * getSystemId:
713 * @ctx: the user data (XML parser context)
714 *
715 * Provides the system ID, basically URL or filename e.g.
716 * http://www.sgmlsource.com/dtds/memo.dtd
717 * DEPRECATED: use xmlSAX2GetSystemId()
718 *
719 * Returns a xmlChar *
720 */
721const xmlChar *
722getSystemId(void *ctx)
723{
724 DEPRECATED("getSystemId")
725 return(xmlSAX2GetSystemId(ctx));
726}
727
728/**
729 * getLineNumber:
730 * @ctx: the user data (XML parser context)
731 *
732 * Provide the line number of the current parsing point.
733 * DEPRECATED: use xmlSAX2GetLineNumber()
734 *
735 * Returns an int
736 */
737int
738getLineNumber(void *ctx)
739{
740 DEPRECATED("getLineNumber")
741 return(xmlSAX2GetLineNumber(ctx));
742}
743
744/**
745 * getColumnNumber:
746 * @ctx: the user data (XML parser context)
747 *
748 * Provide the column number of the current parsing point.
749 * DEPRECATED: use xmlSAX2GetColumnNumber()
750 *
751 * Returns an int
752 */
753int
754getColumnNumber(void *ctx)
755{
756 DEPRECATED("getColumnNumber")
757 return(xmlSAX2GetColumnNumber(ctx));
758}
759
760/**
761 * isStandalone:
762 * @ctx: the user data (XML parser context)
763 *
764 * Is this document tagged standalone ?
765 * DEPRECATED: use xmlSAX2IsStandalone()
766 *
767 * Returns 1 if true
768 */
769int
770isStandalone(void *ctx)
771{
772 DEPRECATED("isStandalone")
773 return(xmlSAX2IsStandalone(ctx));
774}
775
776/**
777 * hasInternalSubset:
778 * @ctx: the user data (XML parser context)
779 *
780 * Does this document has an internal subset
781 * DEPRECATED: use xmlSAX2HasInternalSubset()
782 *
783 * Returns 1 if true
784 */
785int
786hasInternalSubset(void *ctx)
787{
788 DEPRECATED("hasInternalSubset")
789 return(xmlSAX2HasInternalSubset(ctx));
790}
791
792/**
793 * hasExternalSubset:
794 * @ctx: the user data (XML parser context)
795 *
796 * Does this document has an external subset
797 * DEPRECATED: use xmlSAX2HasExternalSubset()
798 *
799 * Returns 1 if true
800 */
801int
802hasExternalSubset(void *ctx)
803{
804 DEPRECATED("hasExternalSubset")
805 return(xmlSAX2HasExternalSubset(ctx));
806}
807
808/**
809 * internalSubset:
810 * @ctx: the user data (XML parser context)
811 * @name: the root element name
812 * @ExternalID: the external ID
813 * @SystemID: the SYSTEM ID (e.g. filename or URL)
814 *
815 * Callback on internal subset declaration.
816 * DEPRECATED: use xmlSAX2InternalSubset()
817 */
818void
819internalSubset(void *ctx, const xmlChar *name,
820 const xmlChar *ExternalID, const xmlChar *SystemID)
821{
822 DEPRECATED("internalSubset")
823 xmlSAX2InternalSubset(ctx, name, ExternalID, SystemID);
824}
825
826/**
827 * externalSubset:
828 * @ctx: the user data (XML parser context)
829 * @name: the root element name
830 * @ExternalID: the external ID
831 * @SystemID: the SYSTEM ID (e.g. filename or URL)
832 *
833 * Callback on external subset declaration.
834 * DEPRECATED: use xmlSAX2ExternalSubset()
835 */
836void
837externalSubset(void *ctx, const xmlChar *name,
838 const xmlChar *ExternalID, const xmlChar *SystemID)
839{
840 DEPRECATED("externalSubset")
841 xmlSAX2ExternalSubset(ctx, name, ExternalID, SystemID);
842}
843
844/**
845 * resolveEntity:
846 * @ctx: the user data (XML parser context)
847 * @publicId: The public ID of the entity
848 * @systemId: The system ID of the entity
849 *
850 * The entity loader, to control the loading of external entities,
851 * the application can either:
852 * - override this resolveEntity() callback in the SAX block
853 * - or better use the xmlSetExternalEntityLoader() function to
854 * set up it's own entity resolution routine
855 * DEPRECATED: use xmlSAX2ResolveEntity()
856 *
857 * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
858 */
859xmlParserInputPtr
860resolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
861{
862 DEPRECATED("resolveEntity")
863 return(xmlSAX2ResolveEntity(ctx, publicId, systemId));
864}
865
866/**
867 * getEntity:
868 * @ctx: the user data (XML parser context)
869 * @name: The entity name
870 *
871 * Get an entity by name
872 * DEPRECATED: use xmlSAX2GetEntity()
873 *
874 * Returns the xmlEntityPtr if found.
875 */
876xmlEntityPtr
877getEntity(void *ctx, const xmlChar *name)
878{
879 DEPRECATED("getEntity")
880 return(xmlSAX2GetEntity(ctx, name));
881}
882
883/**
884 * getParameterEntity:
885 * @ctx: the user data (XML parser context)
886 * @name: The entity name
887 *
888 * Get a parameter entity by name
889 * DEPRECATED: use xmlSAX2GetParameterEntity()
890 *
891 * Returns the xmlEntityPtr if found.
892 */
893xmlEntityPtr
894getParameterEntity(void *ctx, const xmlChar *name)
895{
896 DEPRECATED("getParameterEntity")
897 return(xmlSAX2GetParameterEntity(ctx, name));
898}
899
900
901/**
902 * entityDecl:
903 * @ctx: the user data (XML parser context)
904 * @name: the entity name
905 * @type: the entity type
906 * @publicId: The public ID of the entity
907 * @systemId: The system ID of the entity
908 * @content: the entity value (without processing).
909 *
910 * An entity definition has been parsed
911 * DEPRECATED: use xmlSAX2EntityDecl()
912 */
913void
914entityDecl(void *ctx, const xmlChar *name, int type,
915 const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
916{
917 DEPRECATED("entityDecl")
918 xmlSAX2EntityDecl(ctx, name, type, publicId, systemId, content);
919}
920
921/**
922 * attributeDecl:
923 * @ctx: the user data (XML parser context)
924 * @elem: the name of the element
925 * @fullname: the attribute name
926 * @type: the attribute type
927 * @def: the type of default value
928 * @defaultValue: the attribute default value
929 * @tree: the tree of enumerated value set
930 *
931 * An attribute definition has been parsed
932 * DEPRECATED: use xmlSAX2AttributeDecl()
933 */
934void
935attributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
936 int type, int def, const xmlChar *defaultValue,
937 xmlEnumerationPtr tree)
938{
939 DEPRECATED("attributeDecl")
940 xmlSAX2AttributeDecl(ctx, elem, fullname, type, def, defaultValue, tree);
941}
942
943/**
944 * elementDecl:
945 * @ctx: the user data (XML parser context)
946 * @name: the element name
947 * @type: the element type
948 * @content: the element value tree
949 *
950 * An element definition has been parsed
951 * DEPRECATED: use xmlSAX2ElementDecl()
952 */
953void
954elementDecl(void *ctx, const xmlChar * name, int type,
955 xmlElementContentPtr content)
956{
957 DEPRECATED("elementDecl")
958 xmlSAX2ElementDecl(ctx, name, type, content);
959}
960
961/**
962 * notationDecl:
963 * @ctx: the user data (XML parser context)
964 * @name: The name of the notation
965 * @publicId: The public ID of the entity
966 * @systemId: The system ID of the entity
967 *
968 * What to do when a notation declaration has been parsed.
969 * DEPRECATED: use xmlSAX2NotationDecl()
970 */
971void
972notationDecl(void *ctx, const xmlChar *name,
973 const xmlChar *publicId, const xmlChar *systemId)
974{
975 DEPRECATED("notationDecl")
976 xmlSAX2NotationDecl(ctx, name, publicId, systemId);
977}
978
979/**
980 * unparsedEntityDecl:
981 * @ctx: the user data (XML parser context)
982 * @name: The name of the entity
983 * @publicId: The public ID of the entity
984 * @systemId: The system ID of the entity
985 * @notationName: the name of the notation
986 *
987 * What to do when an unparsed entity declaration is parsed
988 * DEPRECATED: use xmlSAX2UnparsedEntityDecl()
989 */
990void
991unparsedEntityDecl(void *ctx, const xmlChar *name,
992 const xmlChar *publicId, const xmlChar *systemId,
993 const xmlChar *notationName)
994{
995 DEPRECATED("unparsedEntityDecl")
996 xmlSAX2UnparsedEntityDecl(ctx, name, publicId, systemId, notationName);
997}
998
999/**
1000 * setDocumentLocator:
1001 * @ctx: the user data (XML parser context)
1002 * @loc: A SAX Locator
1003 *
1004 * Receive the document locator at startup, actually xmlDefaultSAXLocator
1005 * Everything is available on the context, so this is useless in our case.
1006 * DEPRECATED
1007 */
1008void
1009setDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
1010{
1011 DEPRECATED("setDocumentLocator")
1012}
1013
1014/**
1015 * startDocument:
1016 * @ctx: the user data (XML parser context)
1017 *
1018 * called when the document start being processed.
1019 * DEPRECATED: use xmlSAX2StartDocument()
1020 */
1021void
1022startDocument(void *ctx)
1023{
1024 DEPRECATED("startDocument")
1025 xmlSAX2StartDocument(ctx);
1026}
1027
1028/**
1029 * endDocument:
1030 * @ctx: the user data (XML parser context)
1031 *
1032 * called when the document end has been detected.
1033 * DEPRECATED: use xmlSAX2EndDocument()
1034 */
1035void
1036endDocument(void *ctx)
1037{
1038 DEPRECATED("endDocument")
1039 xmlSAX2EndDocument(ctx);
1040}
1041
1042/**
1043 * attribute:
1044 * @ctx: the user data (XML parser context)
1045 * @fullname: The attribute name, including namespace prefix
1046 * @value: The attribute value
1047 *
1048 * Handle an attribute that has been read by the parser.
1049 * The default handling is to convert the attribute into an
1050 * DOM subtree and past it in a new xmlAttr element added to
1051 * the element.
1052 * DEPRECATED: use xmlSAX2Attribute()
1053 */
1054void
1055attribute(void *ctx ATTRIBUTE_UNUSED, const xmlChar *fullname ATTRIBUTE_UNUSED, const xmlChar *value ATTRIBUTE_UNUSED)
1056{
1057 DEPRECATED("attribute")
1058}
1059
1060/**
1061 * startElement:
1062 * @ctx: the user data (XML parser context)
1063 * @fullname: The element name, including namespace prefix
1064 * @atts: An array of name/value attributes pairs, NULL terminated
1065 *
1066 * called when an opening tag has been processed.
1067 * DEPRECATED: use xmlSAX2StartElement()
1068 */
1069void
1070startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
1071{
1072 DEPRECATED("startElement")
1073 xmlSAX2StartElement(ctx, fullname, atts);
1074}
1075
1076/**
1077 * endElement:
1078 * @ctx: the user data (XML parser context)
1079 * @name: The element name
1080 *
1081 * called when the end of an element has been detected.
1082 * DEPRECATED: use xmlSAX2EndElement()
1083 */
1084void
1085endElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
1086{
1087 DEPRECATED("endElement")
1088 xmlSAX2EndElement(ctx, name);
1089}
1090
1091/**
1092 * reference:
1093 * @ctx: the user data (XML parser context)
1094 * @name: The entity name
1095 *
1096 * called when an entity reference is detected.
1097 * DEPRECATED: use xmlSAX2Reference()
1098 */
1099void
1100reference(void *ctx, const xmlChar *name)
1101{
1102 DEPRECATED("reference")
1103 xmlSAX2Reference(ctx, name);
1104}
1105
1106/**
1107 * characters:
1108 * @ctx: the user data (XML parser context)
1109 * @ch: a xmlChar string
1110 * @len: the number of xmlChar
1111 *
1112 * receiving some chars from the parser.
1113 * DEPRECATED: use xmlSAX2Characters()
1114 */
1115void
1116characters(void *ctx, const xmlChar *ch, int len)
1117{
1118 DEPRECATED("characters")
1119 xmlSAX2Characters(ctx, ch, len);
1120}
1121
1122/**
1123 * ignorableWhitespace:
1124 * @ctx: the user data (XML parser context)
1125 * @ch: a xmlChar string
1126 * @len: the number of xmlChar
1127 *
1128 * receiving some ignorable whitespaces from the parser.
1129 * UNUSED: by default the DOM building will use characters
1130 * DEPRECATED: use xmlSAX2IgnorableWhitespace()
1131 */
1132void
1133ignorableWhitespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED)
1134{
1135 DEPRECATED("ignorableWhitespace")
1136}
1137
1138/**
1139 * processingInstruction:
1140 * @ctx: the user data (XML parser context)
1141 * @target: the target name
1142 * @data: the PI data's
1143 *
1144 * A processing instruction has been parsed.
1145 * DEPRECATED: use xmlSAX2ProcessingInstruction()
1146 */
1147void
1148processingInstruction(void *ctx, const xmlChar *target,
1149 const xmlChar *data)
1150{
1151 DEPRECATED("processingInstruction")
1152 xmlSAX2ProcessingInstruction(ctx, target, data);
1153}
1154
1155/**
1156 * globalNamespace:
1157 * @ctx: the user data (XML parser context)
1158 * @href: the namespace associated URN
1159 * @prefix: the namespace prefix
1160 *
1161 * An old global namespace has been parsed.
1162 * DEPRECATED
1163 */
1164void
1165globalNamespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *href ATTRIBUTE_UNUSED, const xmlChar *prefix ATTRIBUTE_UNUSED)
1166{
1167 DEPRECATED("globalNamespace")
1168}
1169
1170/**
1171 * setNamespace:
1172 * @ctx: the user data (XML parser context)
1173 * @name: the namespace prefix
1174 *
1175 * Set the current element namespace.
1176 * DEPRECATED
1177 */
1178
1179void
1180setNamespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name ATTRIBUTE_UNUSED)
1181{
1182 DEPRECATED("setNamespace")
1183}
1184
1185/**
1186 * getNamespace:
1187 * @ctx: the user data (XML parser context)
1188 *
1189 * Get the current element namespace.
1190 * DEPRECATED
1191 *
1192 * Returns the xmlNsPtr or NULL if none
1193 */
1194
1195xmlNsPtr
1196getNamespace(void *ctx ATTRIBUTE_UNUSED)
1197{
1198 DEPRECATED("getNamespace")
1199 return(NULL);
1200}
1201
1202/**
1203 * checkNamespace:
1204 * @ctx: the user data (XML parser context)
1205 * @namespace: the namespace to check against
1206 *
1207 * Check that the current element namespace is the same as the
1208 * one read upon parsing.
1209 * DEPRECATED
1210 *
1211 * Returns 1 if true 0 otherwise
1212 */
1213
1214int
1215checkNamespace(void *ctx ATTRIBUTE_UNUSED, xmlChar *namespace ATTRIBUTE_UNUSED)
1216{
1217 DEPRECATED("checkNamespace")
1218 return(0);
1219}
1220
1221/**
1222 * namespaceDecl:
1223 * @ctx: the user data (XML parser context)
1224 * @href: the namespace associated URN
1225 * @prefix: the namespace prefix
1226 *
1227 * A namespace has been parsed.
1228 * DEPRECATED
1229 */
1230void
1231namespaceDecl(void *ctx ATTRIBUTE_UNUSED, const xmlChar *href ATTRIBUTE_UNUSED, const xmlChar *prefix ATTRIBUTE_UNUSED)
1232{
1233 DEPRECATED("namespaceDecl")
1234}
1235
1236/**
1237 * comment:
1238 * @ctx: the user data (XML parser context)
1239 * @value: the comment content
1240 *
1241 * A comment has been parsed.
1242 * DEPRECATED: use xmlSAX2Comment()
1243 */
1244void
1245comment(void *ctx, const xmlChar *value)
1246{
1247 DEPRECATED("comment")
1248 xmlSAX2Comment(ctx, value);
1249}
1250
1251/**
1252 * cdataBlock:
1253 * @ctx: the user data (XML parser context)
1254 * @value: The pcdata content
1255 * @len: the block length
1256 *
1257 * called when a pcdata block has been parsed
1258 * DEPRECATED: use xmlSAX2CDataBlock()
1259 */
1260void
1261cdataBlock(void *ctx, const xmlChar *value, int len)
1262{
1263 DEPRECATED("cdataBlock")
1264 xmlSAX2CDataBlock(ctx, value, len);
1265}
1266
1267#endif /* LIBXML_LEGACY_ENABLED */
1268