35 #pragma convert("ISO8859-1") 41 #if defined(_WIN32) && !defined (__CYGWIN__) 42 #define XML_DIR_SEP '\\' 44 #define XML_DIR_SEP '/' 64 #ifdef LIBXML_CATALOG_ENABLED 67 #ifdef LIBXML_SCHEMAS_ENABLED 77 #ifdef HAVE_SYS_STAT_H 105 #define XML_PARSER_BIG_ENTITY 1000 106 #define XML_PARSER_LOT_ENTITY 5000 114 #define XML_PARSER_NON_LINEAR 10 164 if (replacement != 0) {
181 }
else if (
size != 0) {
200 }
else if (ent !=
NULL) {
247 #define XML_PARSER_BIG_BUFFER_SIZE 300 248 #define XML_PARSER_BUFFER_SIZE 100 249 #define SAX_COMPAT_MODE BAD_CAST "SAX compatibility mode document" 260 #define XML_PARSER_CHUNK_SIZE 100 286 #ifdef LIBXML_LEGACY_ENABLED 326 (
const char *) localname,
NULL,
NULL, 0, 0,
327 "Attribute %s redefined\n", localname);
331 (
const char *) prefix, (
const char *) localname,
332 NULL, 0, 0,
"Attribute %s:%s redefined\n", prefix,
359 errmsg =
"CharRef: invalid hexadecimal value";
362 errmsg =
"CharRef: invalid decimal value";
365 errmsg =
"CharRef: invalid value";
368 errmsg =
"internal error";
371 errmsg =
"PEReference at end of document";
374 errmsg =
"PEReference in prolog";
377 errmsg =
"PEReference in epilog";
380 errmsg =
"PEReference: no name";
383 errmsg =
"PEReference: expecting ';'";
386 errmsg =
"Detected an entity reference loop";
389 errmsg =
"EntityValue: \" or ' expected";
392 errmsg =
"PEReferences forbidden in internal subset";
395 errmsg =
"EntityValue: \" or ' expected";
398 errmsg =
"AttValue: \" or ' expected";
401 errmsg =
"Unescaped '<' not allowed in attributes values";
404 errmsg =
"SystemLiteral \" or ' expected";
407 errmsg =
"Unfinished System or Public ID \" or ' expected";
410 errmsg =
"Sequence ']]>' not allowed in content";
413 errmsg =
"SYSTEM or PUBLIC, the URI is missing";
416 errmsg =
"PUBLIC, the Public Identifier is missing";
419 errmsg =
"Comment must not contain '--' (double-hyphen)";
422 errmsg =
"xmlParsePI : no target name";
425 errmsg =
"Invalid PI name";
428 errmsg =
"NOTATION: Name expected here";
431 errmsg =
"'>' required to close NOTATION declaration";
434 errmsg =
"Entity value required";
437 errmsg =
"Fragment not allowed";
440 errmsg =
"'(' required to start ATTLIST enumeration";
443 errmsg =
"NmToken expected in ATTLIST enumeration";
446 errmsg =
"')' required to finish ATTLIST enumeration";
449 errmsg =
"MixedContentDecl : '|' or ')*' expected";
452 errmsg =
"MixedContentDecl : '#PCDATA' expected";
455 errmsg =
"ContentDecl : Name or '(' expected";
458 errmsg =
"ContentDecl : ',' '|' or ')' expected";
462 "PEReference: forbidden within markup decl in internal subset";
468 errmsg =
"XML conditional section '[' expected";
471 errmsg =
"Content error in the external subset";
475 "conditional section INCLUDE or IGNORE keyword expected";
478 errmsg =
"XML conditional section not closed";
481 errmsg =
"Text declaration '<?xml' required";
484 errmsg =
"parsing XML declaration: '?>' expected";
487 errmsg =
"external parsed entities cannot be standalone";
490 errmsg =
"EntityRef: expecting ';'";
493 errmsg =
"DOCTYPE improperly terminated";
496 errmsg =
"EndTag: '</' not found";
502 errmsg =
"String not closed expecting \" or '";
505 errmsg =
"String not started expecting ' or \"";
508 errmsg =
"Invalid XML encoding name";
511 errmsg =
"standalone accepts only 'yes' or 'no'";
514 errmsg =
"Document is empty";
517 errmsg =
"Extra content at the end of the document";
520 errmsg =
"chunk is not well balanced";
523 errmsg =
"extra content at the end of well balanced chunk";
526 errmsg =
"Malformed declaration expecting version";
529 errmsg =
"Name too long use XML_PARSE_HUGE option";
537 errmsg =
"Unregistered error message";
569 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
577 ctxt->wellFormed = 0;
578 if (ctxt->recovery == 0)
579 ctxt->disableSAX = 1;
597 xmlStructuredErrorFunc schannel =
NULL;
599 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
602 if ((ctxt !=
NULL) && (ctxt->sax !=
NULL) &&
604 schannel = ctxt->sax->serror;
606 __xmlRaiseError(schannel,
607 (ctxt->sax) ? ctxt->sax->warning :
NULL,
611 (
const char *) str1, (
const char *) str2,
NULL, 0, 0,
612 msg, (
const char *) str1, (
const char *) str2);
614 __xmlRaiseError(schannel,
NULL,
NULL,
617 (
const char *) str1, (
const char *) str2,
NULL, 0, 0,
618 msg, (
const char *) str1, (
const char *) str2);
635 xmlStructuredErrorFunc schannel =
NULL;
637 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
643 schannel = ctxt->sax->serror;
646 __xmlRaiseError(schannel,
647 ctxt->vctxt.error, ctxt->vctxt.userData,
650 (
const char *) str2,
NULL, 0, 0,
651 msg, (
const char *) str1, (
const char *) str2);
654 __xmlRaiseError(schannel,
NULL,
NULL,
657 (
const char *) str2,
NULL, 0, 0,
658 msg, (
const char *) str1, (
const char *) str2);
675 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
684 ctxt->wellFormed = 0;
685 if (ctxt->recovery == 0)
686 ctxt->disableSAX = 1;
706 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
713 NULL, 0, (
const char *) str1, (
const char *) str2,
716 ctxt->wellFormed = 0;
717 if (ctxt->recovery == 0)
718 ctxt->disableSAX = 1;
735 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
745 ctxt->wellFormed = 0;
746 if (ctxt->recovery == 0)
747 ctxt->disableSAX = 1;
764 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
791 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
798 (
const char *) info2, (
const char *) info3, 0, 0,
msg,
799 info1, info2, info3);
801 ctxt->nsWellFormed = 0;
820 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
825 (
const char *) info2, (
const char *) info3, 0, 0,
msg,
826 info1, info2, info3);
850 #ifdef LIBXML_THREAD_ENABLED 856 #ifdef LIBXML_TREE_ENABLED 862 #ifdef LIBXML_OUTPUT_ENABLED 868 #ifdef LIBXML_PUSH_ENABLED 874 #ifdef LIBXML_READER_ENABLED 880 #ifdef LIBXML_PATTERN_ENABLED 886 #ifdef LIBXML_WRITER_ENABLED 892 #ifdef LIBXML_SAX1_ENABLED 898 #ifdef LIBXML_FTP_ENABLED 904 #ifdef LIBXML_HTTP_ENABLED 910 #ifdef LIBXML_VALID_ENABLED 916 #ifdef LIBXML_HTML_ENABLED 922 #ifdef LIBXML_LEGACY_ENABLED 928 #ifdef LIBXML_C14N_ENABLED 934 #ifdef LIBXML_CATALOG_ENABLED 940 #ifdef LIBXML_XPATH_ENABLED 946 #ifdef LIBXML_XPTR_ENABLED 952 #ifdef LIBXML_XINCLUDE_ENABLED 958 #ifdef LIBXML_ICONV_ENABLED 964 #ifdef LIBXML_ISO8859X_ENABLED 970 #ifdef LIBXML_UNICODE_ENABLED 976 #ifdef LIBXML_REGEXP_ENABLED 982 #ifdef LIBXML_AUTOMATA_ENABLED 988 #ifdef LIBXML_EXPR_ENABLED 994 #ifdef LIBXML_SCHEMAS_ENABLED 1000 #ifdef LIBXML_SCHEMATRON_ENABLED 1006 #ifdef LIBXML_MODULES_ENABLED 1012 #ifdef LIBXML_DEBUG_ENABLED 1018 #ifdef DEBUG_MEMORY_LOCATION 1024 #ifdef LIBXML_DEBUG_RUNTIME 1030 #ifdef LIBXML_ZLIB_ENABLED 1036 #ifdef LIBXML_LZMA_ENABLED 1042 #ifdef LIBXML_ICU_ENABLED 1067 if (ctxt ==
NULL)
return;
1068 #ifdef LIBXML_SAX1_ENABLED 1070 ((ctxt->
sax->startElementNs !=
NULL) ||
1071 (ctxt->
sax->endElementNs !=
NULL))) ctxt->
sax2 = 1;
1090 #if __STDC_VERSION__ >= 199901L 1121 while (*
src == 0x20)
src++;
1124 while (*
src == 0x20)
src++;
1152 int remove_head = 0;
1153 int need_realloc = 0;
1163 while (*cur == 0x20) {
1170 if ((*cur == 0x20) || (*cur == 0)) {
1188 }
else if (remove_head) {
1189 *
len -= remove_head;
1248 (4 * 5) *
sizeof(
const xmlChar *));
1444 if (((cur[0] ==
'i') && (cur[1] ==
'-')) ||
1445 ((cur[0] ==
'I') && (cur[1] ==
'-')) ||
1446 ((cur[0] ==
'x') && (cur[1] ==
'-')) ||
1447 ((cur[0] ==
'X') && (cur[1] ==
'-'))) {
1454 while (((cur[0] >=
'A') && (cur[0] <=
'Z')) ||
1455 ((cur[0] >=
'a') && (cur[0] <=
'z')))
1457 return(cur[0] == 0);
1460 while (((nxt[0] >=
'A') && (nxt[0] <=
'Z')) ||
1461 ((nxt[0] >=
'a') && (nxt[0] <=
'z')))
1463 if (nxt - cur >= 4) {
1467 if ((nxt - cur > 8) || (nxt[0] != 0))
1482 if ((nxt[0] >=
'0') && (nxt[0] <=
'9'))
1485 while (((nxt[0] >=
'A') && (nxt[0] <=
'Z')) ||
1486 ((nxt[0] >=
'a') && (nxt[0] <=
'z')))
1492 if ((nxt - cur >= 5) && (nxt - cur <= 8))
1505 if ((nxt[0] >=
'0') && (nxt[0] <=
'9'))
1508 while (((nxt[0] >=
'A') && (nxt[0] <=
'Z')) ||
1509 ((nxt[0] >=
'a') && (nxt[0] <=
'z')))
1513 if ((nxt - cur >= 5) && (nxt - cur <= 8))
1527 if ((nxt[0] >=
'0') && (nxt[0] <=
'9'))
1530 while (((nxt[0] >=
'A') && (nxt[0] <=
'Z')) ||
1531 ((nxt[0] >=
'a') && (nxt[0] <=
'z')))
1534 if ((nxt - cur >= 5) && (nxt - cur <= 8))
1548 while (((nxt[0] >=
'A') && (nxt[0] <=
'Z')) ||
1549 ((nxt[0] >=
'a') && (nxt[0] <=
'z')))
1552 if ((nxt - cur < 5) || (nxt - cur > 8))
1565 if (((nxt[1] >=
'0') && (nxt[1] <=
'9')) &&
1566 ((nxt[2] >=
'0') && (nxt[2] <=
'9'))) {
1599 for (
i = ctxt->
nsNr - 2;
i >= 0;
i -= 2) {
1600 if (ctxt->
nsTab[
i] == prefix) {
1602 if (ctxt->
nsTab[
i + 1] == URL)
1633 return (ctxt->
nsNr);
1654 if (ctxt->
nsNr <= 0)
1657 for (
i = 0;
i <
nr;
i++) {
1677 attallocs = (
int *)
xmlMalloc((maxatts / 5) *
sizeof(
int));
1678 if (attallocs ==
NULL)
goto mem_error;
1682 maxatts = (
nr + 5) * 2;
1684 maxatts *
sizeof(
const xmlChar *));
1688 (maxatts / 5) *
sizeof(
int));
1689 if (attallocs ==
NULL)
goto mem_error;
1769 if (ctxt ==
NULL)
return(0);
1786 "Excessive depth in document: %d use XML_PARSE_HUGE option\n",
1822 #ifdef LIBXML_PUSH_ENABLED 1907 if (ctxt ==
NULL)
return (-1);
1973 if (ctxt->
spaceNr <= 0)
return(0);
2019 #define RAW (*ctxt->input->cur) 2020 #define CUR (*ctxt->input->cur) 2021 #define NXT(val) ctxt->input->cur[(val)] 2022 #define CUR_PTR ctxt->input->cur 2023 #define BASE_PTR ctxt->input->base 2025 #define CMP4( s, c1, c2, c3, c4 ) \ 2026 ( ((unsigned char *) s)[ 0 ] == c1 && ((unsigned char *) s)[ 1 ] == c2 && \ 2027 ((unsigned char *) s)[ 2 ] == c3 && ((unsigned char *) s)[ 3 ] == c4 ) 2028 #define CMP5( s, c1, c2, c3, c4, c5 ) \ 2029 ( CMP4( s, c1, c2, c3, c4 ) && ((unsigned char *) s)[ 4 ] == c5 ) 2030 #define CMP6( s, c1, c2, c3, c4, c5, c6 ) \ 2031 ( CMP5( s, c1, c2, c3, c4, c5 ) && ((unsigned char *) s)[ 5 ] == c6 ) 2032 #define CMP7( s, c1, c2, c3, c4, c5, c6, c7 ) \ 2033 ( CMP6( s, c1, c2, c3, c4, c5, c6 ) && ((unsigned char *) s)[ 6 ] == c7 ) 2034 #define CMP8( s, c1, c2, c3, c4, c5, c6, c7, c8 ) \ 2035 ( CMP7( s, c1, c2, c3, c4, c5, c6, c7 ) && ((unsigned char *) s)[ 7 ] == c8 ) 2036 #define CMP9( s, c1, c2, c3, c4, c5, c6, c7, c8, c9 ) \ 2037 ( CMP8( s, c1, c2, c3, c4, c5, c6, c7, c8 ) && \ 2038 ((unsigned char *) s)[ 8 ] == c9 ) 2039 #define CMP10( s, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10 ) \ 2040 ( CMP9( s, c1, c2, c3, c4, c5, c6, c7, c8, c9 ) && \ 2041 ((unsigned char *) s)[ 9 ] == c10 ) 2043 #define SKIP(val) do { \ 2044 ctxt->nbChars += (val),ctxt->input->cur += (val),ctxt->input->col+=(val); \ 2045 if (*ctxt->input->cur == 0) \ 2046 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \ 2049 #define SKIPL(val) do { \ 2051 for(skipl=0; skipl<val; skipl++) { \ 2052 if (*(ctxt->input->cur) == '\n') { \ 2053 ctxt->input->line++; ctxt->input->col = 1; \ 2054 } else ctxt->input->col++; \ 2056 ctxt->input->cur++; \ 2058 if (*ctxt->input->cur == 0) \ 2059 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \ 2062 #define SHRINK if ((ctxt->progressive == 0) && \ 2063 (ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \ 2064 (ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \ 2073 #define GROW if ((ctxt->progressive == 0) && \ 2074 (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK)) \ 2101 #define SKIP_BLANKS xmlSkipBlankChars(ctxt) 2103 #define NEXT xmlNextChar(ctxt) 2106 ctxt->input->col++; \ 2107 ctxt->input->cur++; \ 2109 if (*ctxt->input->cur == 0) \ 2110 xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \ 2113 #define NEXTL(l) do { \ 2114 if (*(ctxt->input->cur) == '\n') { \ 2115 ctxt->input->line++; ctxt->input->col = 1; \ 2116 } else ctxt->input->col++; \ 2117 ctxt->input->cur += l; \ 2120 #define CUR_CHAR(l) xmlCurrentChar(ctxt, &l) 2121 #define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l) 2123 #define COPY_BUF(l,b,i,v) \ 2124 if (l == 1) b[i++] = (xmlChar) v; \ 2125 else i += xmlCopyCharMultiByte(&b[i],v) 2172 }
else if (
CUR ==
'%') {
2179 }
else if (
CUR == 0) {
2217 if ((ctxt ==
NULL) || (ctxt->
inputNr <= 1))
return(0);
2220 "Popping input %d\n", ctxt->
inputNr);
2224 "Unfinished entity outside the DTD");
2251 "Pushing input %d : %.30s\n", ctxt->
inputNr+1,
input->cur);
2284 unsigned int val = 0;
2286 unsigned int outofrange = 0;
2291 if ((
RAW ==
'&') && (
NXT(1) ==
'#') &&
2295 while (
RAW !=
';') {
2302 if ((
RAW >=
'0') && (
RAW <=
'9'))
2304 else if ((
RAW >=
'a') && (
RAW <=
'f') && (
count < 20))
2306 else if ((
RAW >=
'A') && (
RAW <=
'F') && (
count < 20))
2325 }
else if ((
RAW ==
'&') && (
NXT(1) ==
'#')) {
2328 while (
RAW !=
';') {
2335 if ((
RAW >=
'0') && (
RAW <=
'9'))
2367 "xmlParseCharRef: invalid xmlChar value %d\n",
2395 unsigned int val = 0;
2396 unsigned int outofrange = 0;
2401 if ((cur ==
'&') && (
ptr[1] ==
'#') && (
ptr[2] ==
'x')) {
2404 while (cur !=
';') {
2405 if ((cur >=
'0') && (cur <=
'9'))
2406 val =
val * 16 + (cur -
'0');
2407 else if ((cur >=
'a') && (cur <=
'f'))
2408 val =
val * 16 + (cur -
'a') + 10;
2409 else if ((cur >=
'A') && (cur <=
'F'))
2410 val =
val * 16 + (cur -
'A') + 10;
2424 }
else if ((cur ==
'&') && (
ptr[1] ==
'#')){
2427 while (cur !=
';') {
2428 if ((cur >=
'0') && (cur <=
'9'))
2429 val =
val * 10 + (cur -
'0');
2458 "xmlParseStringCharRef: invalid xmlChar value %d\n",
2560 #define growBuffer(buffer, n) { \ 2562 size_t new_size = buffer##_size * 2 + n; \ 2563 if (new_size < buffer##_size) goto mem_error; \ 2564 tmp = (xmlChar *) xmlRealloc(buffer, new_size); \ 2565 if (tmp == NULL) goto mem_error; \ 2567 buffer##_size = new_size; \ 2606 if (((ctxt->
depth > 40) &&
2608 (ctxt->
depth > 1024)) {
2628 while ((
c != 0) && (
c !=
end) &&
2629 (
c != end2) && (
c != end3)) {
2632 if ((
c ==
'&') && (
str[1] ==
'#')) {
2643 "String decoding Entity Reference: %.30s\n",
2649 if ((ent !=
NULL) &&
2658 "predefined entity has no content\n");
2680 }
else if (ent !=
NULL) {
2689 buffer[nbchars++] = *cur++;
2695 "String decoding PE Reference: %.30s\n",
str);
2714 "not validating will not read content for PE entity %s\n",
2814 if (ctxt->
sax->ignorableWhitespace == ctxt->
sax->characters)
2821 (*(ctxt->
space) == -2))
2827 if (blank_chars == 0) {
2838 if (
ret == 0)
return(1);
2839 if (
ret == 1)
return(0);
2845 if ((
RAW !=
'<') && (
RAW != 0xD))
return(0);
2847 (
RAW ==
'<') && (
NXT(1) ==
'/'))
return(0);
2850 if (lastChild ==
NULL) {
2901 #ifndef XML_XML_NAMESPACE 2903 if ((cur[0] ==
'x') && (cur[1] ==
'm') &&
2904 (cur[2] ==
'l') && (cur[3] ==
':'))
2913 while ((
c != 0) && (
c !=
':') && (
len <
max)) {
2930 while ((
c != 0) && (
c !=
':')) {
2950 if ((
c ==
':') && (*cur == 0)) {
2978 if (!(((
c >= 0x61) && (
c <= 0x7A)) ||
2979 ((
c >= 0x41) && (
c <= 0x5A)) ||
2980 (
c ==
'_') || (
c ==
':'))) {
2986 "Name %s is not XML Namespace compliant\n",
2992 while ((
c != 0) && (
len <
max)) {
3052 static unsigned long nbParseName = 0;
3053 static unsigned long nbParseNmToken = 0;
3054 static unsigned long nbParseNCName = 0;
3055 static unsigned long nbParseNCNameComplex = 0;
3056 static unsigned long nbParseNameComplex = 0;
3057 static unsigned long nbParseStringName = 0;
3077 if ((
c !=
' ') && (
c !=
'>') && (
c !=
'/') &&
3078 (((
c >=
'a') && (
c <=
'z')) ||
3079 ((
c >=
'A') && (
c <=
'Z')) ||
3080 (
c ==
'_') || (
c ==
':') ||
3081 ((
c >= 0xC0) && (
c <= 0xD6)) ||
3082 ((
c >= 0xD8) && (
c <= 0xF6)) ||
3083 ((
c >= 0xF8) && (
c <= 0x2FF)) ||
3084 ((
c >= 0x370) && (
c <= 0x37D)) ||
3085 ((
c >= 0x37F) && (
c <= 0x1FFF)) ||
3086 ((
c >= 0x200C) && (
c <= 0x200D)) ||
3087 ((
c >= 0x2070) && (
c <= 0x218F)) ||
3088 ((
c >= 0x2C00) && (
c <= 0x2FEF)) ||
3089 ((
c >= 0x3001) && (
c <= 0xD7FF)) ||
3090 ((
c >= 0xF900) && (
c <= 0xFDCF)) ||
3091 ((
c >= 0xFDF0) && (
c <= 0xFFFD)) ||
3092 ((
c >= 0x10000) && (
c <= 0xEFFFF))))
3108 if ((
c !=
' ') && (
c !=
'>') && (
c !=
'/') &&
3109 (((
c >=
'a') && (
c <=
'z')) ||
3110 ((
c >=
'A') && (
c <=
'Z')) ||
3111 ((
c >=
'0') && (
c <=
'9')) ||
3112 (
c ==
'_') || (
c ==
':') ||
3113 (
c ==
'-') || (
c ==
'.') || (
c == 0xB7) ||
3114 ((
c >= 0xC0) && (
c <= 0xD6)) ||
3115 ((
c >= 0xD8) && (
c <= 0xF6)) ||
3116 ((
c >= 0xF8) && (
c <= 0x2FF)) ||
3117 ((
c >= 0x300) && (
c <= 0x36F)) ||
3118 ((
c >= 0x370) && (
c <= 0x37D)) ||
3119 ((
c >= 0x37F) && (
c <= 0x1FFF)) ||
3120 ((
c >= 0x200C) && (
c <= 0x200D)) ||
3121 ((
c >= 0x203F) && (
c <= 0x2040)) ||
3122 ((
c >= 0x2070) && (
c <= 0x218F)) ||
3123 ((
c >= 0x2C00) && (
c <= 0x2FEF)) ||
3124 ((
c >= 0x3001) && (
c <= 0xD7FF)) ||
3125 ((
c >= 0xF900) && (
c <= 0xFDCF)) ||
3126 ((
c >= 0xFDF0) && (
c <= 0xFFFD)) ||
3127 ((
c >= 0x10000) && (
c <= 0xEFFFF))))
3131 (
c ==
'.') || (
c ==
'-') ||
3132 (
c ==
'_') || (
c ==
':') ||
3150 nbParseNameComplex++;
3165 if ((
c ==
' ') || (
c ==
'>') || (
c ==
'/') ||
3166 (!(((
c >=
'a') && (
c <=
'z')) ||
3167 ((
c >=
'A') && (
c <=
'Z')) ||
3168 (
c ==
'_') || (
c ==
':') ||
3169 ((
c >= 0xC0) && (
c <= 0xD6)) ||
3170 ((
c >= 0xD8) && (
c <= 0xF6)) ||
3171 ((
c >= 0xF8) && (
c <= 0x2FF)) ||
3172 ((
c >= 0x370) && (
c <= 0x37D)) ||
3173 ((
c >= 0x37F) && (
c <= 0x1FFF)) ||
3174 ((
c >= 0x200C) && (
c <= 0x200D)) ||
3175 ((
c >= 0x2070) && (
c <= 0x218F)) ||
3176 ((
c >= 0x2C00) && (
c <= 0x2FEF)) ||
3177 ((
c >= 0x3001) && (
c <= 0xD7FF)) ||
3178 ((
c >= 0xF900) && (
c <= 0xFDCF)) ||
3179 ((
c >= 0xFDF0) && (
c <= 0xFFFD)) ||
3180 ((
c >= 0x10000) && (
c <= 0xEFFFF))))) {
3186 while ((
c !=
' ') && (
c !=
'>') && (
c !=
'/') &&
3187 (((
c >=
'a') && (
c <=
'z')) ||
3188 ((
c >=
'A') && (
c <=
'Z')) ||
3189 ((
c >=
'0') && (
c <=
'9')) ||
3190 (
c ==
'_') || (
c ==
':') ||
3191 (
c ==
'-') || (
c ==
'.') || (
c == 0xB7) ||
3192 ((
c >= 0xC0) && (
c <= 0xD6)) ||
3193 ((
c >= 0xD8) && (
c <= 0xF6)) ||
3194 ((
c >= 0xF8) && (
c <= 0x2FF)) ||
3195 ((
c >= 0x300) && (
c <= 0x36F)) ||
3196 ((
c >= 0x370) && (
c <= 0x37D)) ||
3197 ((
c >= 0x37F) && (
c <= 0x1FFF)) ||
3198 ((
c >= 0x200C) && (
c <= 0x200D)) ||
3199 ((
c >= 0x203F) && (
c <= 0x2040)) ||
3200 ((
c >= 0x2070) && (
c <= 0x218F)) ||
3201 ((
c >= 0x2C00) && (
c <= 0x2FEF)) ||
3202 ((
c >= 0x3001) && (
c <= 0xD7FF)) ||
3203 ((
c >= 0xF900) && (
c <= 0xFDCF)) ||
3204 ((
c >= 0xFDF0) && (
c <= 0xFFFD)) ||
3205 ((
c >= 0x10000) && (
c <= 0xEFFFF))
3218 if ((
c ==
' ') || (
c ==
'>') || (
c ==
'/') ||
3227 while ((
c !=
' ') && (
c !=
'>') && (
c !=
'/') &&
3229 (
c ==
'.') || (
c ==
'-') ||
3230 (
c ==
'_') || (
c ==
':') ||
3256 "unexpected change of input buffer");
3296 if (((*
in >= 0x61) && (*
in <= 0x7A)) ||
3297 ((*
in >= 0x41) && (*
in <= 0x5A)) ||
3298 (*
in ==
'_') || (*
in ==
':')) {
3300 while (((*
in >= 0x61) && (*
in <= 0x7A)) ||
3301 ((*
in >= 0x41) && (*
in <= 0x5A)) ||
3302 ((*
in >= 0x30) && (*
in <= 0x39)) ||
3303 (*
in ==
'_') || (*
in ==
'-') ||
3304 (*
in ==
':') || (*
in ==
'.'))
3306 if ((*
in > 0) && (*
in < 0x80)) {
3331 size_t startPosition = 0;
3334 nbParseNCNameComplex++;
3343 if ((
c ==
' ') || (
c ==
'>') || (
c ==
'/') ||
3348 while ((
c !=
' ') && (
c !=
'>') && (
c !=
'/') &&
3417 if ((((*
in >= 0x61) && (*
in <= 0x7A)) ||
3418 ((*
in >= 0x41) && (*
in <= 0x5A)) ||
3419 (*
in ==
'_')) && (
in <
e)) {
3421 while ((((*
in >= 0x61) && (*
in <= 0x7A)) ||
3422 ((*
in >= 0x41) && (*
in <= 0x5A)) ||
3423 ((*
in >= 0x30) && (*
in <= 0x39)) ||
3424 (*
in ==
'_') || (*
in ==
'-') ||
3425 (*
in ==
'.')) && (
in <
e))
3429 if ((*
in > 0) && (*
in < 0x80)) {
3472 while (*
in != 0 && *
in == *
cmp) {
3517 nbParseStringName++;
3712 if (
RAW ==
'"') stop =
'"';
3713 else if (
RAW ==
'\'') stop =
'\'';
3783 if ((*cur ==
'%') || ((*cur ==
'&') && (cur[1] !=
'#'))) {
3794 if ((nameOk == 0) || (*cur !=
';')) {
3796 "EntityValue: '%c' forbidden except for entities references\n",
3800 if ((tmp ==
'%') && (ctxt->
inSubset == 1) &&
3852 size_t buf_size = 0;
3853 int c,
l, in_space = 0;
3857 if (
NXT(0) ==
'"') {
3861 }
else if (
NXT(0) ==
'\'') {
3875 if (
buf ==
NULL)
goto mem_error;
3891 "AttValue length too long\n");
3897 if (
NXT(1) ==
'#') {
3902 if (
len + 10 > buf_size) {
3911 if (
len + 10 > buf_size) {
3920 }
else if (
val != 0) {
3921 if (
len + 10 > buf_size) {
3931 if ((ent !=
NULL) &&
3933 if (
len + 10 > buf_size) {
3946 }
else if ((ent !=
NULL) &&
3963 if (
len + 10 > buf_size) {
3971 if (
len + 10 > buf_size) {
3977 }
else if (ent !=
NULL) {
4009 while (
len +
i + 10 > buf_size) {
4018 if ((
c == 0x20) || (
c == 0xD) || (
c == 0xA) || (
c == 0x9)) {
4022 while (
len + 10 > buf_size) {
4031 if (
len + 10 > buf_size) {
4052 "invalid character in attribute value\n");
4055 "AttValue: ' expected\n");
4066 "AttValue length too long\n");
4148 }
else if (
RAW ==
'\'') {
4163 while ((
IS_CHAR(cur)) && (cur != stop)) {
4237 }
else if (
RAW ==
'\'') {
4304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4305 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4306 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4307 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4308 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x00, 0x27,
4309 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
4310 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
4311 0x38, 0x39, 0x3A, 0x3B, 0x00, 0x3D, 0x3E, 0x3F,
4312 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
4313 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
4314 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
4315 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x00, 0x5E, 0x5F,
4316 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
4317 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
4318 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
4319 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
4320 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4324 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4330 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4332 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4333 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4334 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
4377 }
while (*
in == 0xA);
4378 goto get_more_space;
4387 (ctxt->
sax->ignorableWhitespace !=
4388 ctxt->
sax->characters)) {
4390 if (ctxt->
sax->ignorableWhitespace !=
NULL)
4394 if (ctxt->
sax->characters !=
NULL)
4397 if (*ctxt->
space == -1)
4400 }
else if ((ctxt->
sax !=
NULL) &&
4401 (ctxt->
sax->characters !=
NULL)) {
4420 }
while (*
in == 0xA);
4424 if ((
in[1] ==
']') && (
in[2] ==
'>')) {
4436 (ctxt->
sax->ignorableWhitespace !=
4437 ctxt->
sax->characters) &&
4443 if (ctxt->
sax->ignorableWhitespace !=
NULL)
4447 if (ctxt->
sax->characters !=
NULL)
4450 if (*ctxt->
space == -1)
4455 }
else if (ctxt->
sax !=
NULL) {
4456 if (ctxt->
sax->characters !=
NULL)
4488 }
while (((*
in >= 0x20) && (*
in <= 0x7F)) || (*
in == 0x09));
4515 while ((cur !=
'<') &&
4518 if ((cur ==
']') && (
NXT(1) ==
']') &&
4534 if (ctxt->
sax->ignorableWhitespace !=
NULL)
4538 if (ctxt->
sax->characters !=
NULL)
4540 if ((ctxt->
sax->characters !=
4541 ctxt->
sax->ignorableWhitespace) &&
4542 (*ctxt->
space == -1))
4568 if (ctxt->
sax->ignorableWhitespace !=
NULL)
4571 if (ctxt->
sax->characters !=
NULL)
4573 if ((ctxt->
sax->characters != ctxt->
sax->ignorableWhitespace) &&
4574 (*ctxt->
space == -1))
4579 if ((cur != 0) && (!
IS_CHAR(cur))) {
4582 "PCDATA invalid Char value %d\n",
4617 if (
CMP6(
CUR_PTR,
'S',
'Y',
'S',
'T',
'E',
'M')) {
4621 "Space required after 'SYSTEM'\n");
4627 }
else if (
CMP6(
CUR_PTR,
'P',
'U',
'B',
'L',
'I',
'C')) {
4631 "Space required after 'PUBLIC'\n");
4634 if (*publicID ==
NULL) {
4643 "Space required after the Public Identifier\n");
4653 if ((
CUR !=
'\'') && (
CUR !=
'"'))
return(
NULL);
4700 goto not_terminated;
4703 "xmlParseComment: invalid xmlChar value %d\n",
4711 goto not_terminated;
4714 "xmlParseComment: invalid xmlChar value %d\n",
4722 goto not_terminated;
4725 (
r !=
'-') || (
q !=
'-'))) {
4726 if ((
r ==
'-') && (
q ==
'-')) {
4732 "Comment too big found",
NULL);
4740 new_size =
size * 2;
4742 if (new_buf ==
NULL) {
4776 "Comment not terminated \n<!--%.50s\n",
buf);
4779 "xmlParseComment: invalid xmlChar value %d\n",
4782 if (inputid != ctxt->
input->
id) {
4784 "Comment doesn't start and stop in the same" 4796 "Comment not terminated\n",
NULL);
4825 if ((
RAW !=
'<') || (
NXT(1) !=
'!') ||
4826 (
NXT(2) !=
'-') || (
NXT(3) !=
'-'))
return;
4844 }
while (*
in == 0xA);
4848 while (((*
in >
'-') && (*
in <= 0x7F)) ||
4849 ((*
in >= 0x20) && (*
in <
'-')) ||
4859 }
while (*
in == 0xA);
4868 (ctxt->
sax->comment !=
NULL)) {
4870 if ((*
in ==
'-') && (
in[1] ==
'-'))
4881 }
else if (
len + nbchar + 1 >=
size) {
4886 if (new_buf ==
NULL) {
4902 "Comment too big found",
NULL);
4931 if (ctxt->
input->
id != inputid) {
4933 "comment doesn't start and stop in the" 4952 "Double hyphen within comment: " 4957 "Double hyphen within comment\n",
NULL);
4965 }
while (((*
in >= 0x20) && (*
in <= 0x7F)) || (*
in == 0x09));
4989 ((
name[0] ==
'x') || (
name[0] ==
'X')) &&
4990 ((
name[1] ==
'm') || (
name[1] ==
'M')) &&
4991 ((
name[2] ==
'l') || (
name[2] ==
'L'))) {
4993 if ((
name[0] ==
'x') && (
name[1] ==
'm') &&
4994 (
name[2] ==
'l') && (
name[3] == 0)) {
4996 "XML declaration allowed only at the start of the document\n");
4998 }
else if (
name[3] == 0) {
5008 "xmlParsePITarget: invalid name prefix 'xml'\n",
5013 "colons are forbidden from PI names '%s'\n",
name,
NULL,
NULL);
5018 #ifdef LIBXML_CATALOG_ENABLED 5056 while ((*tmp != 0) && (*tmp !=
marker)) tmp++;
5073 "Catalog PI syntax error: %s\n",
5101 if ((
RAW ==
'<') && (
NXT(1) ==
'?')) {
5102 int inputid = ctxt->
input->
id;
5117 if ((
RAW ==
'?') && (
NXT(1) ==
'>')) {
5118 if (inputid != ctxt->
input->
id) {
5120 "PI declaration doesn't start and stop in" 5121 " the same entity\n");
5129 (ctxt->
sax->processingInstruction !=
NULL))
5144 "ParsePI: PI %s space expected\n",
target);
5148 ((cur !=
'?') || (
NXT(1) !=
'>'))) {
5151 size_t new_size =
size * 2;
5173 "PI %s too big found",
target);
5191 "PI %s too big found",
target);