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