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