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