35#pragma convert("ISO8859-1")
42#define XML_DIR_SEP '\\'
44#define XML_DIR_SEP '/'
65#ifdef LIBXML_CATALOG_ENABLED
77#define NS_INDEX_EMPTY INT_MAX
78#define NS_INDEX_XML (INT_MAX - 1)
79#define URI_HASH_EMPTY 0xD943A04E
80#define URI_HASH_XML 0xF0451F02
117static xmlParserCtxtPtr
120 xmlParserCtxtPtr pctx);
134#define XML_PARSER_BIG_ENTITY 1000
135#define XML_PARSER_LOT_ENTITY 5000
145#define XML_PARSER_ALLOWED_EXPANSION 1000000
152#define XML_ENT_FIXED_COST 20
166#define XML_PARSER_BIG_BUFFER_SIZE 300
167#define XML_PARSER_BUFFER_SIZE 100
168#define SAX_COMPAT_MODE BAD_CAST "SAX compatibility mode document"
179#define XML_PARSER_CHUNK_SIZE 100
206 xmlSAXHandlerPtr sax,
212#ifdef LIBXML_LEGACY_ENABLED
214xmlAddEntityReference(xmlEntityPtr ent, xmlNodePtr firstNode,
215 xmlNodePtr lastNode);
220 const xmlChar *
string,
void *user_data, xmlNodePtr *lst);
243 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
252 (
const char *) localname,
NULL,
NULL, 0, 0,
253 "Attribute %s redefined\n", localname);
257 (
const char *)
prefix, (
const char *) localname,
258 NULL, 0, 0,
"Attribute %s:%s redefined\n",
prefix,
261 ctxt->wellFormed = 0;
262 if (ctxt->recovery == 0)
263 ctxt->disableSAX = 1;
279 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
287 ctxt->wellFormed = 0;
288 if (ctxt->recovery == 0)
289 ctxt->disableSAX = 1;
309 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
312 if ((ctxt !=
NULL) && (ctxt->sax !=
NULL) &&
314 schannel = ctxt->sax->serror;
317 (ctxt->sax) ? ctxt->sax->warning :
NULL,
347 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
353 schannel = ctxt->sax->serror;
357 ctxt->vctxt.error, ctxt->vctxt.userData,
385 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
394 ctxt->wellFormed = 0;
395 if (ctxt->recovery == 0)
396 ctxt->disableSAX = 1;
416 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
426 ctxt->wellFormed = 0;
427 if (ctxt->recovery == 0)
428 ctxt->disableSAX = 1;
445 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
455 ctxt->wellFormed = 0;
456 if (ctxt->recovery == 0)
457 ctxt->disableSAX = 1;
474 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
501 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
508 (
const char *) info2, (
const char *) info3, 0, 0,
msg,
509 info1, info2, info3);
511 ctxt->nsWellFormed = 0;
530 if ((ctxt !=
NULL) && (ctxt->disableSAX != 0) &&
535 (
const char *) info2, (
const char *) info3, 0, 0,
msg,
536 info1, info2, info3);
583 xmlParserInputPtr
input = ctxt->input;
612 (ctxt->sizeentcopy / ctxt->maxAmpl >
consumed))) {
614 "Maximum entity amplification factor exceeded, see "
615 "xmlCtxtSetMaxAmplification.\n");
644#ifdef LIBXML_THREAD_ENABLED
650#ifdef LIBXML_TREE_ENABLED
656#ifdef LIBXML_OUTPUT_ENABLED
662#ifdef LIBXML_PUSH_ENABLED
668#ifdef LIBXML_READER_ENABLED
674#ifdef LIBXML_PATTERN_ENABLED
680#ifdef LIBXML_WRITER_ENABLED
686#ifdef LIBXML_SAX1_ENABLED
692#ifdef LIBXML_FTP_ENABLED
698#ifdef LIBXML_HTTP_ENABLED
704#ifdef LIBXML_VALID_ENABLED
710#ifdef LIBXML_HTML_ENABLED
716#ifdef LIBXML_LEGACY_ENABLED
722#ifdef LIBXML_C14N_ENABLED
728#ifdef LIBXML_CATALOG_ENABLED
734#ifdef LIBXML_XPATH_ENABLED
740#ifdef LIBXML_XPTR_ENABLED
746#ifdef LIBXML_XINCLUDE_ENABLED
752#ifdef LIBXML_ICONV_ENABLED
758#ifdef LIBXML_ISO8859X_ENABLED
764#ifdef LIBXML_UNICODE_ENABLED
770#ifdef LIBXML_REGEXP_ENABLED
776#ifdef LIBXML_AUTOMATA_ENABLED
782#ifdef LIBXML_EXPR_ENABLED
788#ifdef LIBXML_SCHEMAS_ENABLED
794#ifdef LIBXML_SCHEMATRON_ENABLED
800#ifdef LIBXML_MODULES_ENABLED
806#ifdef LIBXML_DEBUG_ENABLED
812#ifdef DEBUG_MEMORY_LOCATION
820#ifdef LIBXML_ZLIB_ENABLED
826#ifdef LIBXML_LZMA_ENABLED
832#ifdef LIBXML_ICU_ENABLED
857 xmlSAXHandlerPtr sax;
862 if (ctxt ==
NULL)
return;
864#ifdef LIBXML_SAX1_ENABLED
870 ((sax->startElementNs !=
NULL) ||
871 (sax->endElementNs !=
NULL) ||
872 ((sax->startElement ==
NULL) && (sax->endElement ==
NULL))))
880 ctxt->str_xml_ns =
xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36);
881 if ((ctxt->str_xml==
NULL) || (ctxt->str_xmlns==
NULL) ||
882 (ctxt->str_xml_ns ==
NULL)) {
901#if __STDC_VERSION__ >= 199901L
932 while (*
src == 0x20)
src++;
935 while (*
src == 0x20)
src++;
964 int need_realloc = 0;
974 while (*
cur == 0x20) {
981 if ((*
cur == 0x20) || (*
cur == 0)) {
999 }
else if (remove_head) {
1000 *
len -= remove_head;
1023 int len, expandedSize;
1032 if (ctxt->attsSpecial !=
NULL) {
1037 if (ctxt->attsDefault ==
NULL) {
1039 if (ctxt->attsDefault ==
NULL)
1048 if (localname ==
NULL) {
1076 temp->maxAttrs = newSize;
1089 localname = xmlSplitQName3(fullattr, &
len);
1090 if (localname ==
NULL) {
1111 expandedSize +=
len;
1118 attr->external = ctxt->external;
1119 attr->expandedSize = expandedSize;
1143 if (ctxt->attsSpecial ==
NULL) {
1145 if (ctxt->attsSpecial ==
NULL)
1170 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)
data;
1172 if (((
ptrdiff_t) payload) == XML_ATTRIBUTE_CDATA) {
1188 if (ctxt->attsSpecial ==
NULL)
1195 ctxt->attsSpecial =
NULL;
1267 if (((
cur[0] ==
'i') && (
cur[1] ==
'-')) ||
1268 ((
cur[0] ==
'I') && (
cur[1] ==
'-')) ||
1269 ((
cur[0] ==
'x') && (
cur[1] ==
'-')) ||
1270 ((
cur[0] ==
'X') && (
cur[1] ==
'-'))) {
1277 while (((
cur[0] >=
'A') && (
cur[0] <=
'Z')) ||
1278 ((
cur[0] >=
'a') && (
cur[0] <=
'z')))
1280 return(
cur[0] == 0);
1283 while (((nxt[0] >=
'A') && (nxt[0] <=
'Z')) ||
1284 ((nxt[0] >=
'a') && (nxt[0] <=
'z')))
1286 if (nxt -
cur >= 4) {
1290 if ((nxt -
cur > 8) || (nxt[0] != 0))
1305 if ((nxt[0] >=
'0') && (nxt[0] <=
'9'))
1308 while (((nxt[0] >=
'A') && (nxt[0] <=
'Z')) ||
1309 ((nxt[0] >=
'a') && (nxt[0] <=
'z')))
1315 if ((nxt -
cur >= 5) && (nxt -
cur <= 8))
1328 if ((nxt[0] >=
'0') && (nxt[0] <=
'9'))
1331 while (((nxt[0] >=
'A') && (nxt[0] <=
'Z')) ||
1332 ((nxt[0] >=
'a') && (nxt[0] <=
'z')))
1336 if ((nxt -
cur >= 5) && (nxt -
cur <= 8))
1350 if ((nxt[0] >=
'0') && (nxt[0] <=
'9'))
1353 while (((nxt[0] >=
'A') && (nxt[0] <=
'Z')) ||
1354 ((nxt[0] >=
'a') && (nxt[0] <=
'z')))
1357 if ((nxt -
cur >= 5) && (nxt -
cur <= 8))
1371 while (((nxt[0] >=
'A') && (nxt[0] <=
'Z')) ||
1372 ((nxt[0] >=
'a') && (nxt[0] <=
'z')))
1375 if ((nxt -
cur < 5) || (nxt -
cur > 8))
1388 if (((nxt[1] >=
'0') && (nxt[1] <=
'9')) &&
1389 ((nxt[2] >=
'0') && (nxt[2] <=
'9'))) {
1418 memset(nsdb, 0,
sizeof(*nsdb));
1493 unsigned index, hashValue;
1496 return(ctxt->nsdb->defaultNsIndex);
1498 if (ctxt->nsdb->hashSize == 0)
1501 hashValue =
prefix->hashValue;
1502 index = hashValue & (ctxt->nsdb->hashSize - 1);
1503 bucket = &ctxt->nsdb->hash[
index];
1508 if (tombstone ==
NULL)
1510 }
else if (bucket->
hashValue == hashValue) {
1511 if (ctxt->nsTab[bucket->
index * 2] ==
prefix->name) {
1512 if (bucketPtr !=
NULL)
1513 *bucketPtr = bucket;
1514 return(bucket->
index);
1520 if (
index == ctxt->nsdb->hashSize) {
1522 bucket = ctxt->nsdb->hash;
1526 if (bucketPtr !=
NULL)
1527 *bucketPtr = tombstone ? tombstone : bucket;
1545 if (
prefix->name == ctxt->str_xml)
1546 return(ctxt->str_xml_ns);
1552 ret = ctxt->nsTab[nsIndex * 2 + 1];
1573 if (
prefix == ctxt->str_xml)
1585 return(ctxt->nsdb->extra[nsIndex].saxData);
1606 if (
prefix == ctxt->str_xml)
1618 ctxt->nsdb->extra[nsIndex].saxData = saxData;
1636 if (ctxt->nsMax >
INT_MAX / 2)
1638 newSize = ctxt->nsMax ? ctxt->nsMax * 2 : 16;
1643 ctxt->nsTab =
table;
1648 ctxt->nsdb->extra =
extra;
1650 ctxt->nsMax = newSize;
1677 unsigned hashValue, nsIndex, oldIndex;
1691 oldIndex = ctxt->nsdb->defaultNsIndex;
1694 extra = &ctxt->nsdb->extra[oldIndex];
1696 if (
extra->elementId == ctxt->nsdb->elementId) {
1703 (
uri->name == ctxt->nsTab[oldIndex * 2 + 1]))
1707 ctxt->nsdb->defaultNsIndex = ctxt->nsNr;
1708 goto populate_entry;
1716 extra = &ctxt->nsdb->extra[oldIndex];
1721 if (
extra->elementId == ctxt->nsdb->elementId) {
1728 (
uri->name == ctxt->nsTab[bucket->
index * 2 + 1]))
1731 bucket->
index = ctxt->nsNr;
1732 goto populate_entry;
1739 hashValue =
prefix->hashValue;
1744 if (ctxt->nsdb->hashElems + 1 > ctxt->nsdb->hashSize / 2) {
1746 unsigned newSize,
i,
index;
1748 if (ctxt->nsdb->hashSize >
UINT_MAX / 2) {
1752 newSize = ctxt->nsdb->hashSize ? ctxt->nsdb->hashSize * 2 : 16;
1753 newHash =
xmlMalloc(newSize *
sizeof(newHash[0]));
1754 if (newHash ==
NULL) {
1758 memset(newHash, 0, newSize *
sizeof(newHash[0]));
1760 for (
i = 0;
i < ctxt->nsdb->hashSize;
i++) {
1761 unsigned hv = ctxt->nsdb->hash[
i].hashValue;
1764 if ((hv == 0) || (ctxt->nsdb->hash[
i].index ==
INT_MAX))
1766 newIndex = hv & (newSize - 1);
1768 while (newHash[newIndex].hashValue != 0) {
1770 if (newIndex == newSize)
1774 newHash[newIndex] = ctxt->nsdb->hash[
i];
1778 ctxt->nsdb->hash = newHash;
1779 ctxt->nsdb->hashSize = newSize;
1784 index = hashValue & (newSize - 1);
1786 while (newHash[
index].hashValue != 0) {
1788 if (
index == newSize)
1792 bucket = &newHash[
index];
1796 bucket->
index = ctxt->nsNr;
1797 ctxt->nsdb->hashElems++;
1801 nsIndex = ctxt->nsNr;
1803 ns = &ctxt->nsTab[nsIndex * 2];
1807 extra = &ctxt->nsdb->extra[nsIndex];
1808 extra->saxData = saxData;
1810 extra->uriHashValue =
uri->hashValue;
1811 extra->elementId = ctxt->nsdb->elementId;
1812 extra->oldIndex = oldIndex;
1835 for (
i = ctxt->nsNr - 1;
i >= ctxt->nsNr -
nr;
i--) {
1840 ctxt->nsdb->defaultNsIndex =
extra->oldIndex;
1860 unsigned *attallocs;
1863 if (
nr + 5 > ctxt->maxatts) {
1864 maxatts = ctxt->maxatts == 0 ? 55 : (
nr + 5) * 2;
1866 maxatts *
sizeof(
const xmlChar *));
1869 (maxatts / 5) *
sizeof(attallocs[0]));
1870 if (attallocs ==
NULL) {
1874 if (ctxt->maxatts > 0)
1878 ctxt->attallocs = attallocs;
1879 ctxt->maxatts = maxatts;
1881 return(ctxt->maxatts);
1901 if (ctxt->inputNr >= ctxt->inputMax) {
1902 size_t newSize = ctxt->inputMax * 2;
1903 xmlParserInputPtr *tmp;
1905 tmp = (xmlParserInputPtr *)
xmlRealloc(ctxt->inputTab,
1906 newSize *
sizeof(*tmp));
1911 ctxt->inputTab = tmp;
1912 ctxt->inputMax = newSize;
1914 ctxt->inputTab[ctxt->inputNr] =
value;
1915 ctxt->input =
value;
1916 return (ctxt->inputNr++);
1929 xmlParserInputPtr
ret;
1933 if (ctxt->inputNr <= 0)
1936 if (ctxt->inputNr > 0)
1937 ctxt->input = ctxt->inputTab[ctxt->inputNr - 1];
1940 ret = ctxt->inputTab[ctxt->inputNr];
1941 ctxt->inputTab[ctxt->inputNr] =
NULL;
1958 if (ctxt ==
NULL)
return(0);
1959 if (ctxt->nodeNr >= ctxt->nodeMax) {
1962 tmp = (xmlNodePtr *)
xmlRealloc(ctxt->nodeTab,
1964 sizeof(ctxt->nodeTab[0]));
1969 ctxt->nodeTab = tmp;
1975 "Excessive depth in document: %d use XML_PARSE_HUGE option\n",
1980 ctxt->nodeTab[ctxt->nodeNr] =
value;
1982 return (ctxt->nodeNr++);
2001 if (ctxt->nodeNr <= 0)
2004 if (ctxt->nodeNr > 0)
2005 ctxt->node = ctxt->nodeTab[ctxt->nodeNr - 1];
2008 ret = ctxt->nodeTab[ctxt->nodeNr];
2009 ctxt->nodeTab[ctxt->nodeNr] =
NULL;
2032 if (ctxt->nameNr >= ctxt->nameMax) {
2038 sizeof(ctxt->nameTab[0]));
2043 ctxt->nameTab = tmp;
2046 sizeof(ctxt->pushTab[0]));
2051 ctxt->pushTab = tmp2;
2052 }
else if (ctxt->pushTab ==
NULL) {
2054 sizeof(ctxt->pushTab[0]));
2055 if (ctxt->pushTab ==
NULL)
2058 ctxt->nameTab[ctxt->nameNr] =
value;
2060 tag = &ctxt->pushTab[ctxt->nameNr];
2065 return (ctxt->nameNr++);
2070#ifdef LIBXML_PUSH_ENABLED
2080nameNsPop(xmlParserCtxtPtr ctxt)
2084 if (ctxt->nameNr <= 0)
2087 if (ctxt->nameNr > 0)
2088 ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
2091 ret = ctxt->nameTab[ctxt->nameNr];
2092 ctxt->nameTab[ctxt->nameNr] =
NULL;
2111 if (ctxt ==
NULL)
return (-1);
2113 if (ctxt->nameNr >= ctxt->nameMax) {
2117 sizeof(ctxt->nameTab[0]));
2121 ctxt->nameTab = tmp;
2124 ctxt->nameTab[ctxt->nameNr] =
value;
2126 return (ctxt->nameNr++);
2147 if ((ctxt ==
NULL) || (ctxt->nameNr <= 0))
2150 if (ctxt->nameNr > 0)
2151 ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
2154 ret = ctxt->nameTab[ctxt->nameNr];
2155 ctxt->nameTab[ctxt->nameNr] =
NULL;
2160 if (ctxt->spaceNr >= ctxt->spaceMax) {
2163 ctxt->spaceMax *= 2;
2165 ctxt->spaceMax *
sizeof(ctxt->spaceTab[0]));
2171 ctxt->spaceTab = tmp;
2173 ctxt->spaceTab[ctxt->spaceNr] =
val;
2174 ctxt->space = &ctxt->spaceTab[ctxt->spaceNr];
2175 return(ctxt->spaceNr++);
2180 if (ctxt->spaceNr <= 0)
return(0);
2182 if (ctxt->spaceNr > 0)
2183 ctxt->space = &ctxt->spaceTab[ctxt->spaceNr - 1];
2185 ctxt->space = &ctxt->spaceTab[0];
2186 ret = ctxt->spaceTab[ctxt->spaceNr];
2187 ctxt->spaceTab[ctxt->spaceNr] = -1;
2226#define RAW (*ctxt->input->cur)
2227#define CUR (*ctxt->input->cur)
2228#define NXT(val) ctxt->input->cur[(val)]
2229#define CUR_PTR ctxt->input->cur
2230#define BASE_PTR ctxt->input->base
2232#define CMP4( s, c1, c2, c3, c4 ) \
2233 ( ((unsigned char *) s)[ 0 ] == c1 && ((unsigned char *) s)[ 1 ] == c2 && \
2234 ((unsigned char *) s)[ 2 ] == c3 && ((unsigned char *) s)[ 3 ] == c4 )
2235#define CMP5( s, c1, c2, c3, c4, c5 ) \
2236 ( CMP4( s, c1, c2, c3, c4 ) && ((unsigned char *) s)[ 4 ] == c5 )
2237#define CMP6( s, c1, c2, c3, c4, c5, c6 ) \
2238 ( CMP5( s, c1, c2, c3, c4, c5 ) && ((unsigned char *) s)[ 5 ] == c6 )
2239#define CMP7( s, c1, c2, c3, c4, c5, c6, c7 ) \
2240 ( CMP6( s, c1, c2, c3, c4, c5, c6 ) && ((unsigned char *) s)[ 6 ] == c7 )
2241#define CMP8( s, c1, c2, c3, c4, c5, c6, c7, c8 ) \
2242 ( CMP7( s, c1, c2, c3, c4, c5, c6, c7 ) && ((unsigned char *) s)[ 7 ] == c8 )
2243#define CMP9( s, c1, c2, c3, c4, c5, c6, c7, c8, c9 ) \
2244 ( CMP8( s, c1, c2, c3, c4, c5, c6, c7, c8 ) && \
2245 ((unsigned char *) s)[ 8 ] == c9 )
2246#define CMP10( s, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10 ) \
2247 ( CMP9( s, c1, c2, c3, c4, c5, c6, c7, c8, c9 ) && \
2248 ((unsigned char *) s)[ 9 ] == c10 )
2250#define SKIP(val) do { \
2251 ctxt->input->cur += (val),ctxt->input->col+=(val); \
2252 if (*ctxt->input->cur == 0) \
2253 xmlParserGrow(ctxt); \
2256#define SKIPL(val) do { \
2258 for(skipl=0; skipl<val; skipl++) { \
2259 if (*(ctxt->input->cur) == '\n') { \
2260 ctxt->input->line++; ctxt->input->col = 1; \
2261 } else ctxt->input->col++; \
2262 ctxt->input->cur++; \
2264 if (*ctxt->input->cur == 0) \
2265 xmlParserGrow(ctxt); \
2270 if (((ctxt->progressive == 0) || (ctxt->inputNr > 1)) && \
2271 (ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \
2272 (ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \
2273 xmlParserShrink(ctxt);
2275#define GROW if (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK) \
2276 xmlParserGrow(ctxt);
2278#define SKIP_BLANKS xmlSkipBlankChars(ctxt)
2280#define NEXT xmlNextChar(ctxt)
2283 ctxt->input->col++; \
2284 ctxt->input->cur++; \
2285 if (*ctxt->input->cur == 0) \
2286 xmlParserGrow(ctxt); \
2289#define NEXTL(l) do { \
2290 if (*(ctxt->input->cur) == '\n') { \
2291 ctxt->input->line++; ctxt->input->col = 1; \
2292 } else ctxt->input->col++; \
2293 ctxt->input->cur += l; \
2296#define CUR_CHAR(l) xmlCurrentChar(ctxt, &l)
2297#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l)
2299#define COPY_BUF(b, i, v) \
2300 if (v < 0x80) b[i++] = v; \
2301 else i += xmlCopyCharMultiByte(&b[i],v)
2323 if (((ctxt->inputNr == 1) && (ctxt->instate !=
XML_PARSER_DTD)) ||
2329 cur = ctxt->input->cur;
2332 ctxt->input->line++; ctxt->input->col = 1;
2340 ctxt->input->cur =
cur;
2342 cur = ctxt->input->cur;
2345 ctxt->input->cur =
cur;
2347 int expandPE = ((ctxt->external != 0) || (ctxt->inputNr != 1));
2352 }
else if (
CUR ==
'%') {
2359 }
else if (
CUR == 0) {
2363 if (ctxt->inputNr <= 1)
2368 ctxt->input->cur - ctxt->input->base);
2374 ent = ctxt->input->entity;
2420 xmlParserInputPtr
input;
2422 if ((ctxt ==
NULL) || (ctxt->inputNr <= 1))
return(0);
2425 "Popping input %d\n", ctxt->inputNr);
2426 if ((ctxt->inputNr > 1) && (ctxt->inSubset == 0) &&
2429 "Unfinished entity outside the DTD");
2432 input->entity->flags &= ~XML_ENT_EXPANDING;
2434 if (*ctxt->input->cur == 0)
2454 if ((ctxt->input !=
NULL) && (ctxt->input->filename))
2456 "%s(%d): ", ctxt->input->filename,
2459 "Pushing input %d : %.30s\n", ctxt->inputNr+1,
input->cur);
2461 if (((ctxt->inputNr > 40) && ((ctxt->options &
XML_PARSE_HUGE) == 0)) ||
2462 (ctxt->inputNr > 100)) {
2464 while (ctxt->inputNr > 1)
2500 if ((
RAW ==
'&') && (
NXT(1) ==
'#') &&
2504 while (
RAW !=
';') {
2511 if ((
RAW >=
'0') && (
RAW <=
'9'))
2513 else if ((
RAW >=
'a') && (
RAW <=
'f') && (
count < 20))
2515 else if ((
RAW >=
'A') && (
RAW <=
'F') && (
count < 20))
2533 }
else if ((
RAW ==
'&') && (
NXT(1) ==
'#')) {
2536 while (
RAW !=
';') {
2543 if ((
RAW >=
'0') && (
RAW <=
'9'))
2572 if (
val >= 0x110000) {
2574 "xmlParseCharRef: character reference out of bounds\n",
2580 "xmlParseCharRef: invalid xmlChar value %d\n",
2613 if ((
cur ==
'&') && (
ptr[1] ==
'#') && (
ptr[2] ==
'x')) {
2616 while (
cur !=
';') {
2617 if ((
cur >=
'0') && (
cur <=
'9'))
2619 else if ((
cur >=
'a') && (
cur <=
'f'))
2621 else if ((
cur >=
'A') && (
cur <=
'F'))
2636 }
else if ((
cur ==
'&') && (
ptr[1] ==
'#')){
2639 while (
cur !=
';') {
2640 if ((
cur >=
'0') && (
cur <=
'9'))
2666 if (
val >= 0x110000) {
2668 "xmlParseStringCharRef: character reference out of bounds\n",
2674 "xmlParseStringCharRef: invalid xmlChar value %d\n",
2716 switch(ctxt->instate) {
2762 if ((ctxt->external == 0) && (ctxt->inputNr == 1))
2779#define growBuffer(buffer, n) { \
2781 size_t new_size = buffer##_size * 2 + n; \
2782 if (new_size < buffer##_size) goto mem_error; \
2783 tmp = (xmlChar *) xmlRealloc(buffer, new_size); \
2784 if (tmp == NULL) goto mem_error; \
2786 buffer##_size = new_size; \
2818 if (((ctxt->depth > 40) &&
2820 (ctxt->depth > 100)) {
2822 "Maximum entity nesting depth exceeded");
2841 while ((
c != 0) && (
c !=
end) &&
2842 (
c != end2) && (
c != end3) &&
2846 if ((
c ==
'&') && (
str[1] ==
'#')) {
2857 "String decoding Entity Reference: %.30s\n",
2860 if ((ent !=
NULL) &&
2862 if (ent->content !=
NULL) {
2869 "predefined entity has no content\n");
2872 }
else if ((ent !=
NULL) && (ent->content !=
NULL)) {
2879 ent->content[0] = 0;
2886 ent->length, what, 0, 0, 0,
check);
2888 ent->flags &= ~XML_ENT_EXPANDING;
2891 ent->content[0] = 0;
2904 }
else if (ent !=
NULL) {
2919 "String decoding PE Reference: %.30s\n",
str);
2922 if (ent->content ==
NULL) {
2931 (ctxt->validate != 0)) {
2935 "not validating will not read content for PE entity %s\n",
2946 if (ent->content !=
NULL)
2947 ent->content[0] = 0;
2954 ent->length, what, 0, 0, 0,
check);
2956 ent->flags &= ~XML_ENT_EXPANDING;
2959 if (ent->content !=
NULL)
2960 ent->content[0] = 0;
3026 end, end2, end3, 0));
3054 end, end2, end3, 0));
3078 xmlNodePtr lastChild;
3084 if (ctxt->sax->ignorableWhitespace == ctxt->sax->characters)
3090 if ((ctxt->space ==
NULL) || (*(ctxt->space) == 1) ||
3091 (*(ctxt->space) == -2))
3097 if (blank_chars == 0) {
3105 if (ctxt->node ==
NULL)
return(0);
3106 if (ctxt->myDoc !=
NULL) {
3108 if (
ret == 0)
return(1);
3109 if (
ret == 1)
return(0);
3115 if ((
RAW !=
'<') && (
RAW != 0xD))
return(0);
3116 if ((ctxt->node->children ==
NULL) &&
3117 (
RAW ==
'<') && (
NXT(1) ==
'/'))
return(0);
3119 lastChild = xmlGetLastChild(ctxt->node);
3120 if (lastChild ==
NULL) {
3121 if ((ctxt->node->type != XML_ELEMENT_NODE) &&
3122 (ctxt->node->content !=
NULL))
return(0);
3123 }
else if (xmlNodeIsText(lastChild))
3125 else if ((ctxt->node->children !=
NULL) &&
3126 (xmlNodeIsText(ctxt->node->children)))
3171#ifndef XML_XML_NAMESPACE
3173 if ((
cur[0] ==
'x') && (
cur[1] ==
'm') &&
3174 (
cur[2] ==
'l') && (
cur[3] ==
':'))
3183 while ((
c != 0) && (
c !=
':') && (
len <
max)) {
3200 while ((
c != 0) && (
c !=
':')) {
3219 if ((
c ==
':') && (*
cur == 0)) {
3247 if (!(((
c >= 0x61) && (
c <= 0x7A)) ||
3248 ((
c >= 0x41) && (
c <= 0x5A)) ||
3249 (
c ==
'_') || (
c ==
':'))) {
3255 "Name %s is not XML Namespace compliant\n",
3261 while ((
c != 0) && (
len <
max)) {
3337 if ((
c !=
' ') && (
c !=
'>') && (
c !=
'/') &&
3338 (((
c >=
'a') && (
c <=
'z')) ||
3339 ((
c >=
'A') && (
c <=
'Z')) ||
3340 (
c ==
'_') || (
c ==
':') ||
3341 ((
c >= 0xC0) && (
c <= 0xD6)) ||
3342 ((
c >= 0xD8) && (
c <= 0xF6)) ||
3343 ((
c >= 0xF8) && (
c <= 0x2FF)) ||
3344 ((
c >= 0x370) && (
c <= 0x37D)) ||
3345 ((
c >= 0x37F) && (
c <= 0x1FFF)) ||
3346 ((
c >= 0x200C) && (
c <= 0x200D)) ||
3347 ((
c >= 0x2070) && (
c <= 0x218F)) ||
3348 ((
c >= 0x2C00) && (
c <= 0x2FEF)) ||
3349 ((
c >= 0x3001) && (
c <= 0xD7FF)) ||
3350 ((
c >= 0xF900) && (
c <= 0xFDCF)) ||
3351 ((
c >= 0xFDF0) && (
c <= 0xFFFD)) ||
3352 ((
c >= 0x10000) && (
c <= 0xEFFFF))))
3368 if ((
c !=
' ') && (
c !=
'>') && (
c !=
'/') &&
3369 (((
c >=
'a') && (
c <=
'z')) ||
3370 ((
c >=
'A') && (
c <=
'Z')) ||
3371 ((
c >=
'0') && (
c <=
'9')) ||
3372 (
c ==
'_') || (
c ==
':') ||
3373 (
c ==
'-') || (
c ==
'.') || (
c == 0xB7) ||
3374 ((
c >= 0xC0) && (
c <= 0xD6)) ||
3375 ((
c >= 0xD8) && (
c <= 0xF6)) ||
3376 ((
c >= 0xF8) && (
c <= 0x2FF)) ||
3377 ((
c >= 0x300) && (
c <= 0x36F)) ||
3378 ((
c >= 0x370) && (
c <= 0x37D)) ||
3379 ((
c >= 0x37F) && (
c <= 0x1FFF)) ||
3380 ((
c >= 0x200C) && (
c <= 0x200D)) ||
3381 ((
c >= 0x203F) && (
c <= 0x2040)) ||
3382 ((
c >= 0x2070) && (
c <= 0x218F)) ||
3383 ((
c >= 0x2C00) && (
c <= 0x2FEF)) ||
3384 ((
c >= 0x3001) && (
c <= 0xD7FF)) ||
3385 ((
c >= 0xF900) && (
c <= 0xFDCF)) ||
3386 ((
c >= 0xFDF0) && (
c <= 0xFFFD)) ||
3387 ((
c >= 0x10000) && (
c <= 0xEFFFF))))
3391 (
c ==
'.') || (
c ==
'-') ||
3392 (
c ==
'_') || (
c ==
':') ||
3420 if ((
c ==
' ') || (
c ==
'>') || (
c ==
'/') ||
3421 (!(((
c >=
'a') && (
c <=
'z')) ||
3422 ((
c >=
'A') && (
c <=
'Z')) ||
3423 (
c ==
'_') || (
c ==
':') ||
3424 ((
c >= 0xC0) && (
c <= 0xD6)) ||
3425 ((
c >= 0xD8) && (
c <= 0xF6)) ||
3426 ((
c >= 0xF8) && (
c <= 0x2FF)) ||
3427 ((
c >= 0x370) && (
c <= 0x37D)) ||
3428 ((
c >= 0x37F) && (
c <= 0x1FFF)) ||
3429 ((
c >= 0x200C) && (
c <= 0x200D)) ||
3430 ((
c >= 0x2070) && (
c <= 0x218F)) ||
3431 ((
c >= 0x2C00) && (
c <= 0x2FEF)) ||
3432 ((
c >= 0x3001) && (
c <= 0xD7FF)) ||
3433 ((
c >= 0xF900) && (
c <= 0xFDCF)) ||
3434 ((
c >= 0xFDF0) && (
c <= 0xFFFD)) ||
3435 ((
c >= 0x10000) && (
c <= 0xEFFFF))))) {
3441 while ((
c !=
' ') && (
c !=
'>') && (
c !=
'/') &&
3442 (((
c >=
'a') && (
c <=
'z')) ||
3443 ((
c >=
'A') && (
c <=
'Z')) ||
3444 ((
c >=
'0') && (
c <=
'9')) ||
3445 (
c ==
'_') || (
c ==
':') ||
3446 (
c ==
'-') || (
c ==
'.') || (
c == 0xB7) ||
3447 ((
c >= 0xC0) && (
c <= 0xD6)) ||
3448 ((
c >= 0xD8) && (
c <= 0xF6)) ||
3449 ((
c >= 0xF8) && (
c <= 0x2FF)) ||
3450 ((
c >= 0x300) && (
c <= 0x36F)) ||
3451 ((
c >= 0x370) && (
c <= 0x37D)) ||
3452 ((
c >= 0x37F) && (
c <= 0x1FFF)) ||
3453 ((
c >= 0x200C) && (
c <= 0x200D)) ||
3454 ((
c >= 0x203F) && (
c <= 0x2040)) ||
3455 ((
c >= 0x2070) && (
c <= 0x218F)) ||
3456 ((
c >= 0x2C00) && (
c <= 0x2FEF)) ||
3457 ((
c >= 0x3001) && (
c <= 0xD7FF)) ||
3458 ((
c >= 0xF900) && (
c <= 0xFDCF)) ||
3459 ((
c >= 0xFDF0) && (
c <= 0xFFFD)) ||
3460 ((
c >= 0x10000) && (
c <= 0xEFFFF))
3468 if ((
c ==
' ') || (
c ==
'>') || (
c ==
'/') ||
3477 while ((
c !=
' ') && (
c !=
'>') && (
c !=
'/') &&
3479 (
c ==
'.') || (
c ==
'-') ||
3480 (
c ==
'_') || (
c ==
':') ||
3495 if (ctxt->input->cur - ctxt->input->base <
len) {
3502 "unexpected change of input buffer");
3505 if ((*ctxt->input->cur ==
'\n') && (ctxt->input->cur[-1] ==
'\r'))
3544 in = ctxt->input->cur;
3545 if (((*
in >= 0x61) && (*
in <= 0x7A)) ||
3546 ((*
in >= 0x41) && (*
in <= 0x5A)) ||
3547 (*
in ==
'_') || (*
in ==
':')) {
3549 while (((*
in >= 0x61) && (*
in <= 0x7A)) ||
3550 ((*
in >= 0x41) && (*
in <= 0x5A)) ||
3551 ((*
in >= 0x30) && (*
in <= 0x39)) ||
3552 (*
in ==
'_') || (*
in ==
'-') ||
3553 (*
in ==
':') || (*
in ==
'.'))
3555 if ((*
in > 0) && (*
in < 0x80)) {
3556 count =
in - ctxt->input->cur;
3562 ctxt->input->cur =
in;
3563 ctxt->input->col +=
count;
3581 size_t startPosition = 0;
3591 if ((
c ==
' ') || (
c ==
'>') || (
c ==
'/') ||
3596 while ((
c !=
' ') && (
c !=
'>') && (
c !=
'/') &&
3642 in = ctxt->input->cur;
3643 e = ctxt->input->end;
3644 if ((((*
in >= 0x61) && (*
in <= 0x7A)) ||
3645 ((*
in >= 0x41) && (*
in <= 0x5A)) ||
3646 (*
in ==
'_')) && (
in <
e)) {
3648 while ((((*
in >= 0x61) && (*
in <= 0x7A)) ||
3649 ((*
in >= 0x41) && (*
in <= 0x5A)) ||
3650 ((*
in >= 0x30) && (*
in <= 0x39)) ||
3651 (*
in ==
'_') || (*
in ==
'-') ||
3652 (*
in ==
'.')) && (
in <
e))
3656 if ((*
in > 0) && (*
in < 0x80)) {
3657 count =
in - ctxt->input->cur;
3663 ctxt->input->cur =
in;
3664 ctxt->input->col +=
count;
3696 in = ctxt->input->cur;
3697 while (*
in != 0 && *
in == *
cmp) {
3703 ctxt->input->col +=
in - ctxt->input->cur;
3704 ctxt->input->cur =
in;
3917 xmlParserInputPtr
input;
3919 if (
RAW ==
'"') stop =
'"';
3920 else if (
RAW ==
'\'') stop =
'\'';
3936 input = ctxt->input;
3976 "entity value too long\n");
3996 if ((*
cur ==
'%') || ((*
cur ==
'&') && (
cur[1] !=
'#'))) {
4007 if ((nameOk == 0) || (*
cur !=
';')) {
4009 "EntityValue: '%c' forbidden except for entities references\n",
4013 if ((tmp ==
'%') && (ctxt->inSubset == 1) &&
4014 (ctxt->inputNr == 1)) {
4066 size_t buf_size = 0;
4070 int c,
l, in_space = 0;
4074 if (
NXT(0) ==
'"') {
4078 }
else if (
NXT(0) ==
'\'') {
4092 if (
buf ==
NULL)
goto mem_error;
4103 if (
NXT(1) ==
'#') {
4107 if (ctxt->replaceEntities) {
4108 if (
len + 10 > buf_size) {
4117 if (
len + 10 > buf_size) {
4126 }
else if (
val != 0) {
4127 if (
len + 10 > buf_size) {
4134 if ((ent !=
NULL) &&
4136 if (
len + 10 > buf_size) {
4139 if ((ctxt->replaceEntities == 0) &&
4140 (ent->content[0] ==
'&')) {
4147 buf[
len++] = ent->content[0];
4149 }
else if ((ent !=
NULL) &&
4150 (ctxt->replaceEntities != 0)) {
4169 if (
len + 10 > buf_size) {
4177 if (
len + 10 > buf_size) {
4180 if (ent->content !=
NULL)
4181 buf[
len++] = ent->content[0];
4183 }
else if (ent !=
NULL) {
4193 (ent->content !=
NULL)) {
4195 unsigned long oldCopy = ctxt->sizeentcopy;
4197 ctxt->sizeentcopy = ent->length;
4201 ent->content, ent->length,
4212 if (ctxt->inSubset == 0) {
4214 ent->expandedSize = ctxt->sizeentcopy;
4221 ent->content[0] = 0;
4236 while (
len +
i + 10 > buf_size) {
4245 if ((
c == 0x20) || (
c == 0xD) || (
c == 0xA) || (
c == 0x9)) {
4249 while (
len + 10 > buf_size) {
4258 if (
len + 10 > buf_size) {
4268 "AttValue length too long\n");
4284 "invalid character in attribute value\n");
4287 "AttValue: ' expected\n");
4292 if (attlen !=
NULL) *attlen =
len;
4343 if ((ctxt ==
NULL) || (ctxt->input ==
NULL))
return(
NULL);
4370 int state = ctxt->instate;
4375 }
else if (
RAW ==
'\'') {
4456 }
else if (
RAW ==
'\'') {
4502 ctxt->instate = oldstate;
4512 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4513 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4514 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4515 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4516 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x00, 0x27,
4517 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
4518 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
4519 0x38, 0x39, 0x3A, 0x3B, 0x00, 0x3D, 0x3E, 0x3F,
4520 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
4521 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
4522 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
4523 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x00, 0x5E, 0x5F,
4524 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
4525 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
4526 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
4527 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
4528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4529 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4530 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4531 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4532 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4533 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4534 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4535 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4536 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4537 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4538 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4539 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4541 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4542 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4543 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
4565 int line = ctxt->input->line;
4566 int col = ctxt->input->col;
4574 in = ctxt->input->cur;
4577 while (*
in == 0x20) {
in++; ctxt->input->col++; }
4580 ctxt->input->line++; ctxt->input->col = 1;
4582 }
while (*
in == 0xA);
4583 goto get_more_space;
4586 nbchar =
in - ctxt->input->cur;
4588 const xmlChar *tmp = ctxt->input->cur;
4589 ctxt->input->cur =
in;
4591 if ((ctxt->sax !=
NULL) &&
4592 (ctxt->disableSAX == 0) &&
4593 (ctxt->sax->ignorableWhitespace !=
4594 ctxt->sax->characters)) {
4596 if (ctxt->sax->ignorableWhitespace !=
NULL)
4597 ctxt->sax->ignorableWhitespace(ctxt->userData,
4600 if (ctxt->sax->characters !=
NULL)
4601 ctxt->sax->characters(ctxt->userData,
4603 if (*ctxt->space == -1)
4606 }
else if ((ctxt->sax !=
NULL) &&
4607 (ctxt->disableSAX == 0) &&
4608 (ctxt->sax->characters !=
NULL)) {
4609 ctxt->sax->characters(ctxt->userData,
4617 ccol = ctxt->input->col;
4622 ctxt->input->col = ccol;
4625 ctxt->input->line++; ctxt->input->col = 1;
4627 }
while (*
in == 0xA);
4631 if ((
in[1] ==
']') && (
in[2] ==
'>')) {
4634 ctxt->input->cur =
in + 1;
4641 nbchar =
in - ctxt->input->cur;
4643 if ((ctxt->sax !=
NULL) &&
4644 (ctxt->disableSAX == 0) &&
4645 (ctxt->sax->ignorableWhitespace !=
4646 ctxt->sax->characters) &&
4648 const xmlChar *tmp = ctxt->input->cur;
4649 ctxt->input->cur =
in;
4652 if (ctxt->sax->ignorableWhitespace !=
NULL)
4653 ctxt->sax->ignorableWhitespace(ctxt->userData,
4656 if (ctxt->sax->characters !=
NULL)
4657 ctxt->sax->characters(ctxt->userData,
4659 if (*ctxt->space == -1)
4662 line = ctxt->input->line;
4663 col = ctxt->input->col;
4664 }
else if ((ctxt->sax !=
NULL) &&
4665 (ctxt->disableSAX == 0)) {
4666 if (ctxt->sax->characters !=
NULL)
4667 ctxt->sax->characters(ctxt->userData,
4668 ctxt->input->cur, nbchar);
4669 line = ctxt->input->line;
4670 col = ctxt->input->col;
4675 ctxt->input->cur =
in;
4679 ctxt->input->cur =
in;
4681 ctxt->input->line++; ctxt->input->col = 1;
4696 in = ctxt->input->cur;
4697 }
while (((*
in >= 0x20) && (*
in <= 0x7F)) ||
4698 (*
in == 0x09) || (*
in == 0x0a));
4699 ctxt->input->line =
line;
4700 ctxt->input->col = col;
4722 while ((
cur !=
'<') &&
4725 if ((
cur ==
']') && (
NXT(1) ==
']') && (
NXT(2) ==
'>')) {
4737 if ((ctxt->sax !=
NULL) && (!ctxt->disableSAX)) {
4739 if (ctxt->sax->ignorableWhitespace !=
NULL)
4740 ctxt->sax->ignorableWhitespace(ctxt->userData,
4743 if (ctxt->sax->characters !=
NULL)
4744 ctxt->sax->characters(ctxt->userData,
buf, nbchar);
4745 if ((ctxt->sax->characters !=
4746 ctxt->sax->ignorableWhitespace) &&
4747 (*ctxt->space == -1))
4766 if ((ctxt->sax !=
NULL) && (!ctxt->disableSAX)) {
4768 if (ctxt->sax->ignorableWhitespace !=
NULL)
4769 ctxt->sax->ignorableWhitespace(ctxt->userData,
buf, nbchar);
4771 if (ctxt->sax->characters !=
NULL)
4772 ctxt->sax->characters(ctxt->userData,
buf, nbchar);
4773 if ((ctxt->sax->characters != ctxt->sax->ignorableWhitespace) &&
4774 (*ctxt->space == -1))
4787 if (ctxt->input->cur < ctxt->input->end) {
4788 if ((
cur == 0) && (
CUR != 0)) {
4791 "Incomplete UTF-8 sequence starting with %02X\n",
CUR);
4794 }
else if ((
cur !=
'<') && (
cur !=
'&')) {
4797 "PCDATA invalid Char value %d\n",
cur);
4844 if (
CMP6(
CUR_PTR,
'S',
'Y',
'S',
'T',
'E',
'M')) {
4848 "Space required after 'SYSTEM'\n");
4854 }
else if (
CMP6(
CUR_PTR,
'P',
'U',
'B',
'L',
'I',
'C')) {
4858 "Space required after 'PUBLIC'\n");
4861 if (*publicID ==
NULL) {
4870 "Space required after the Public Identifier\n");
4880 if ((
CUR !=
'\'') && (
CUR !=
'"'))
return(
NULL);
4915 inputid = ctxt->input->id;
4928 goto not_terminated;
4931 "xmlParseComment: invalid xmlChar value %d\n",
4939 goto not_terminated;
4942 "xmlParseComment: invalid xmlChar value %d\n",
4950 goto not_terminated;
4953 (
r !=
'-') || (
q !=
'-'))) {
4954 if ((
r ==
'-') && (
q ==
'-')) {
4963 if (new_buf ==
NULL) {
4974 "Comment too big found",
NULL);
4995 "Comment not terminated \n<!--%.50s\n",
buf);
4998 "xmlParseComment: invalid xmlChar value %d\n",
5001 if (inputid != ctxt->input->id) {
5003 "Comment doesn't start and stop in the same"
5007 if ((ctxt->sax !=
NULL) && (ctxt->sax->comment !=
NULL) &&
5008 (!ctxt->disableSAX))
5009 ctxt->sax->comment(ctxt->userData,
buf);
5015 "Comment not terminated\n",
NULL);
5050 if ((
RAW !=
'<') || (
NXT(1) !=
'!'))
5053 if ((
RAW !=
'-') || (
NXT(1) !=
'-'))
5055 state = ctxt->instate;
5057 inputid = ctxt->input->id;
5065 in = ctxt->input->cur;
5069 ctxt->input->line++; ctxt->input->col = 1;
5071 }
while (*
in == 0xA);
5074 ccol = ctxt->input->col;
5075 while (((*
in >
'-') && (*
in <= 0x7F)) ||
5076 ((*
in >= 0x20) && (*
in <
'-')) ||
5081 ctxt->input->col = ccol;
5084 ctxt->input->line++; ctxt->input->col = 1;
5086 }
while (*
in == 0xA);
5089 nbchar =
in - ctxt->input->cur;
5095 if ((*
in ==
'-') && (
in[1] ==
'-'))
5102 ctxt->instate =
state;
5106 }
else if (
len + nbchar + 1 >=
size) {
5110 if (new_buf ==
NULL) {
5113 ctxt->instate =
state;
5124 "Comment too big found",
NULL);
5128 ctxt->input->cur =
in;
5131 ctxt->input->line++; ctxt->input->col = 1;
5136 ctxt->input->cur =
in;
5138 ctxt->input->line++; ctxt->input->col = 1;
5149 in = ctxt->input->cur;
5153 if (ctxt->input->id != inputid) {
5155 "comment doesn't start and stop in the"
5159 if ((ctxt->sax !=
NULL) && (ctxt->sax->comment !=
NULL) &&
5160 (!ctxt->disableSAX)) {
5162 ctxt->sax->comment(ctxt->userData,
buf);
5164 ctxt->sax->comment(ctxt->userData,
BAD_CAST "");
5169 ctxt->instate =
state;
5174 "Double hyphen within comment: "
5179 "Double hyphen within comment\n",
NULL);
5191 }
while (((*
in >= 0x20) && (*
in <= 0x7F)) || (*
in == 0x09) || (*
in == 0x0a));
5193 ctxt->instate =
state;
5217 ((
name[0] ==
'x') || (
name[0] ==
'X')) &&
5218 ((
name[1] ==
'm') || (
name[1] ==
'M')) &&
5219 ((
name[2] ==
'l') || (
name[2] ==
'L'))) {
5221 if ((
name[0] ==
'x') && (
name[1] ==
'm') &&
5222 (
name[2] ==
'l') && (
name[3] == 0)) {
5224 "XML declaration allowed only at the start of the document\n");
5226 }
else if (
name[3] == 0) {
5236 "xmlParsePITarget: invalid name prefix 'xml'\n",
5241 "colons are forbidden from PI names '%s'\n",
name,
NULL,
NULL);
5246#ifdef LIBXML_CATALOG_ENABLED
5263xmlParseCatalogPI(xmlParserCtxtPtr ctxt,
const xmlChar *catalog) {
5284 while ((*tmp != 0) && (*tmp !=
marker)) tmp++;
5294 ctxt->catalogs = xmlCatalogAddLocal(ctxt->catalogs, URL);
5301 "Catalog PI syntax error: %s\n",
5333 if ((
RAW ==
'<') && (
NXT(1) ==
'?')) {
5334 int inputid = ctxt->input->id;
5335 state = ctxt->instate;
5348 if ((
RAW ==
'?') && (
NXT(1) ==
'>')) {
5349 if (inputid != ctxt->input->id) {
5351 "PI declaration doesn't start and stop in"
5352 " the same entity\n");
5359 if ((ctxt->sax) && (!ctxt->disableSAX) &&
5360 (ctxt->sax->processingInstruction !=
NULL))
5361 ctxt->sax->processingInstruction(ctxt->userData,
5364 ctxt->instate =
state;
5370 ctxt->instate =
state;
5375 "ParsePI: PI %s space expected\n",
target);
5379 ((
cur !=
'?') || (
NXT(1) !=
'>'))) {
5387 ctxt->instate =
state;
5396 "PI %s too big found",
target);
5398 ctxt->instate =
state;
5411 "ParsePI: PI %s never end ...\n",
target);
5413 if (inputid != ctxt->input->id) {
5415 "PI declaration doesn't start and stop in"
5416 " the same entity\n");
5420#ifdef LIBXML_CATALOG_ENABLED
5424 xmlCatalogAllow allow = xmlCatalogGetDefaults();
5425 if ((allow == XML_CATA_ALLOW_DOCUMENT) ||
5426 (allow == XML_CATA_ALLOW_ALL))
5427 xmlParseCatalogPI(ctxt,
buf);
5435 if ((ctxt->sax) && (!ctxt->disableSAX) &&
5436 (ctxt->sax->processingInstruction !=
NULL))
5437 ctxt->sax->processingInstruction(ctxt->userData,
5445 ctxt->instate =
state;
5473 if ((
CUR !=
'<') || (
NXT(1) !=
'!'))
5477 if (
CMP8(
CUR_PTR,
'N',
'O',
'T',
'A',
'T',
'I',
'O',
'N')) {
5478 int inputid = ctxt->input->id;
5482 "Space required after '<!NOTATION'\n");
5493 "colons are forbidden from notation names '%s'\n",
5498 "Space required after the NOTATION name'\n");
5509 if (inputid != ctxt->input->id) {
5511 "Notation declaration doesn't start and stop"
5512 " in the same entity\n");
5515 if ((ctxt->sax !=
NULL) && (!ctxt->disableSAX) &&
5516 (ctxt->sax->notationDecl !=
NULL))
5517 ctxt->sax->notationDecl(ctxt->userData,
name, Pubid, Systemid);
5556 int isParameter = 0;
5559 if ((
CUR !=
'<') || (
NXT(1) !=
'!'))
5564 if (
CMP6(
CUR_PTR,
'E',
'N',
'T',
'I',
'T',
'Y')) {
5565 int inputid = ctxt->input->id;
5569 "Space required after '<!ENTITY'\n");
5576 "Space required after '%%'\n");
5584 "xmlParseEntityDecl: no name\n");
5589 "colons are forbidden from entities names '%s'\n",
5594 "Space required after the entity name\n");
5602 if ((
RAW ==
'"') || (
RAW ==
'\'')) {
5605 if ((ctxt->sax !=
NULL) &&
5606 (!ctxt->disableSAX) && (ctxt->sax->entityDecl !=
NULL))
5607 ctxt->sax->entityDecl(ctxt->userData,
name,
5613 if ((URI ==
NULL) && (literal ==
NULL)) {
5622 "Invalid URI: %s\n", URI);
5636 if ((ctxt->sax !=
NULL) &&
5637 (!ctxt->disableSAX) &&
5638 (ctxt->sax->entityDecl !=
NULL))
5639 ctxt->sax->entityDecl(ctxt->userData,
name,
5641 literal, URI,
NULL);
5648 if ((
RAW ==
'"') || (
RAW ==
'\'')) {
5650 if ((ctxt->sax !=
NULL) &&
5651 (!ctxt->disableSAX) && (ctxt->sax->entityDecl !=
NULL))
5652 ctxt->sax->entityDecl(ctxt->userData,
name,
5658 if ((ctxt->myDoc ==
NULL) ||
5660 if (ctxt->myDoc ==
NULL) {
5662 if (ctxt->myDoc ==
NULL) {
5666 ctxt->myDoc->properties = XML_DOC_INTERNAL;
5668 if (ctxt->myDoc->intSubset ==
NULL)
5669 ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc,
5677 if ((URI ==
NULL) && (literal ==
NULL)) {
5686 "Invalid URI: %s\n", URI);
5705 "Space required before 'NDATA'\n");
5711 "Space required after 'NDATA'\n");
5714 if ((ctxt->sax !=
NULL) && (!ctxt->disableSAX) &&
5715 (ctxt->sax->unparsedEntityDecl !=
NULL))
5716 ctxt->sax->unparsedEntityDecl(ctxt->userData,
name,
5717 literal, URI, ndata);
5719 if ((ctxt->sax !=
NULL) &&
5720 (!ctxt->disableSAX) && (ctxt->sax->entityDecl !=
NULL))
5721 ctxt->sax->entityDecl(ctxt->userData,
name,
5723 literal, URI,
NULL);
5728 if ((ctxt->replaceEntities != 0) &&
5729 ((ctxt->myDoc ==
NULL) ||
5731 if (ctxt->myDoc ==
NULL) {
5733 if (ctxt->myDoc ==
NULL) {
5737 ctxt->myDoc->properties = XML_DOC_INTERNAL;
5740 if (ctxt->myDoc->intSubset ==
NULL)
5741 ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc,
5745 literal, URI,
NULL);
5755 "xmlParseEntityDecl: entity %s not terminated\n",
name);
5758 if (inputid != ctxt->input->id) {
5760 "Entity declaration doesn't start and stop in"
5761 " the same entity\n");
5772 if ((ctxt->sax !=
NULL) &&
5773 (ctxt->sax->getParameterEntity !=
NULL))
5774 cur = ctxt->sax->getParameterEntity(ctxt->userData,
name);
5776 if ((ctxt->sax !=
NULL) &&
5777 (ctxt->sax->getEntity !=
NULL))
5778 cur = ctxt->sax->getEntity(ctxt->userData,
name);
5779 if ((
cur ==
NULL) && (ctxt->userData==ctxt)) {
5834 if (
CMP9(
CUR_PTR,
'#',
'R',
'E',
'Q',
'U',
'I',
'R',
'E',
'D')) {
5836 return(XML_ATTRIBUTE_REQUIRED);
5838 if (
CMP8(
CUR_PTR,
'#',
'I',
'M',
'P',
'L',
'I',
'E',
'D')) {
5840 return(XML_ATTRIBUTE_IMPLIED);
5842 val = XML_ATTRIBUTE_NONE;
5843 if (
CMP6(
CUR_PTR,
'#',
'F',
'I',
'X',
'E',
'D')) {
5845 val = XML_ATTRIBUTE_FIXED;
5848 "Space required after '#FIXED'\n");
5855 "Attribute default value declaration error\n");
5895 "Name expected in NOTATION declaration\n");
5900 while (tmp !=
NULL) {
5903 "standalone: attribute notation value token %s duplicated\n",
5924 }
while (
RAW ==
'|');
5969 while (tmp !=
NULL) {
5972 "standalone: attribute enumeration value token %s duplicated\n",
5995 }
while (
RAW ==
'|');
6023 if (
CMP8(
CUR_PTR,
'N',
'O',
'T',
'A',
'T',
'I',
'O',
'N')) {
6027 "Space required after 'NOTATION'\n");
6032 return(XML_ATTRIBUTE_NOTATION);
6036 return(XML_ATTRIBUTE_ENUMERATION);
6090 return(XML_ATTRIBUTE_CDATA);
6091 }
else if (
CMP6(
CUR_PTR,
'I',
'D',
'R',
'E',
'F',
'S')) {
6093 return(XML_ATTRIBUTE_IDREFS);
6094 }
else if (
CMP5(
CUR_PTR,
'I',
'D',
'R',
'E',
'F')) {
6096 return(XML_ATTRIBUTE_IDREF);
6097 }
else if ((
RAW ==
'I') && (
NXT(1) ==
'D')) {
6099 return(XML_ATTRIBUTE_ID);
6100 }
else if (
CMP6(
CUR_PTR,
'E',
'N',
'T',
'I',
'T',
'Y')) {
6102 return(XML_ATTRIBUTE_ENTITY);
6103 }
else if (
CMP8(
CUR_PTR,
'E',
'N',
'T',
'I',
'T',
'I',
'E',
'S')) {
6105 return(XML_ATTRIBUTE_ENTITIES);
6106 }
else if (
CMP8(
CUR_PTR,
'N',
'M',
'T',
'O',
'K',
'E',
'N',
'S')) {
6108 return(XML_ATTRIBUTE_NMTOKENS);
6109 }
else if (
CMP7(
CUR_PTR,
'N',
'M',
'T',
'O',
'K',
'E',
'N')) {
6111 return(XML_ATTRIBUTE_NMTOKEN);
6133 xmlEnumerationPtr
tree;
6135 if ((
CUR !=
'<') || (
NXT(1) !=
'!'))
6139 if (
CMP7(
CUR_PTR,
'A',
'T',
'T',
'L',
'I',
'S',
'T')) {
6140 int inputid = ctxt->input->id;
6145 "Space required after '<!ATTLIST'\n");
6148 if (elemName ==
NULL) {
6150 "ATTLIST: no name for Element\n");
6163 if (attrName ==
NULL) {
6165 "ATTLIST: no name for Attribute\n");
6171 "Space required after the attribute name\n");
6183 "Space required after the attribute type\n");
6191 if (defaultValue !=
NULL)
6197 if ((
type != XML_ATTRIBUTE_CDATA) && (defaultValue !=
NULL))
6204 "Space required after the attribute default value\n");
6205 if (defaultValue !=
NULL)
6212 if ((ctxt->sax !=
NULL) && (!ctxt->disableSAX) &&
6213 (ctxt->sax->attributeDecl !=
NULL))
6214 ctxt->sax->attributeDecl(ctxt->userData, elemName, attrName,
6219 if ((ctxt->sax2) && (defaultValue !=
NULL) &&
6220 (def != XML_ATTRIBUTE_IMPLIED) &&
6221 (def != XML_ATTRIBUTE_REQUIRED)) {
6227 if (defaultValue !=
NULL)
6232 if (inputid != ctxt->input->id) {
6234 "Attribute list declaration doesn't start and"
6235 " stop in the same entity\n");
6269 if (
CMP7(
CUR_PTR,
'#',
'P',
'C',
'D',
'A',
'T',
'A')) {
6273 if (ctxt->input->id != inputchk) {
6275 "Element content declaration doesn't start and"
6276 " stop in the same entity\n");
6283 ret->ocur = XML_ELEMENT_CONTENT_MULT;
6288 if ((
RAW ==
'(') || (
RAW ==
'|')) {
6322 "xmlParseElementMixedContentDecl : Name expected\n");
6329 if ((
RAW ==
')') && (
NXT(1) ==
'*')) {
6332 XML_ELEMENT_CONTENT_ELEMENT);
6337 ret->ocur = XML_ELEMENT_CONTENT_MULT;
6338 if (ctxt->input->id != inputchk) {
6340 "Element content declaration doesn't start and"
6341 " stop in the same entity\n");
6388static xmlElementContentPtr
6398"xmlParseElementChildrenContentDecl : depth %d too deep, use XML_PARSE_HUGE\n",
6405 int inputid = ctxt->input->id;
6429 cur->ocur = XML_ELEMENT_CONTENT_OPT;
6431 }
else if (
RAW ==
'*') {
6432 cur->ocur = XML_ELEMENT_CONTENT_MULT;
6434 }
else if (
RAW ==
'+') {
6435 cur->ocur = XML_ELEMENT_CONTENT_PLUS;
6438 cur->ocur = XML_ELEMENT_CONTENT_ONCE;
6455 "xmlParseElementChildrenContentDecl : '%c' expected\n",
6487 }
else if (
RAW ==
'|') {
6495 "xmlParseElementChildrenContentDecl : '%c' expected\n",
6540 int inputid = ctxt->input->id;
6567 last->ocur = XML_ELEMENT_CONTENT_OPT;
6569 }
else if (
RAW ==
'*') {
6570 last->ocur = XML_ELEMENT_CONTENT_MULT;
6572 }
else if (
RAW ==
'+') {
6573 last->ocur = XML_ELEMENT_CONTENT_PLUS;
6576 last->ocur = XML_ELEMENT_CONTENT_ONCE;
6587 if (ctxt->input->id != inputchk) {
6589 "Element content declaration doesn't start and stop in"
6590 " the same entity\n");
6595 if ((
ret->ocur == XML_ELEMENT_CONTENT_PLUS) ||
6596 (
ret->ocur == XML_ELEMENT_CONTENT_MULT))
6597 ret->ocur = XML_ELEMENT_CONTENT_MULT;
6599 ret->ocur = XML_ELEMENT_CONTENT_OPT;
6602 }
else if (
RAW ==
'*') {
6604 ret->ocur = XML_ELEMENT_CONTENT_MULT;
6610 while ((
cur !=
NULL) && (
cur->type == XML_ELEMENT_CONTENT_OR)) {
6612 ((
cur->c1->ocur == XML_ELEMENT_CONTENT_OPT) ||
6613 (
cur->c1->ocur == XML_ELEMENT_CONTENT_MULT)))
6614 cur->c1->ocur = XML_ELEMENT_CONTENT_ONCE;
6616 ((
cur->c2->ocur == XML_ELEMENT_CONTENT_OPT) ||
6617 (
cur->c2->ocur == XML_ELEMENT_CONTENT_MULT)))
6618 cur->c2->ocur = XML_ELEMENT_CONTENT_ONCE;
6623 }
else if (
RAW ==
'+') {
6627 if ((
ret->ocur == XML_ELEMENT_CONTENT_OPT) ||
6628 (
ret->ocur == XML_ELEMENT_CONTENT_MULT))
6629 ret->ocur = XML_ELEMENT_CONTENT_MULT;
6631 ret->ocur = XML_ELEMENT_CONTENT_PLUS;
6637 while ((
cur !=
NULL) && (
cur->type == XML_ELEMENT_CONTENT_OR)) {
6639 ((
cur->c1->ocur == XML_ELEMENT_CONTENT_OPT) ||
6640 (
cur->c1->ocur == XML_ELEMENT_CONTENT_MULT))) {
6641 cur->c1->ocur = XML_ELEMENT_CONTENT_ONCE;
6645 ((
cur->c2->ocur == XML_ELEMENT_CONTENT_OPT) ||
6646 (
cur->c2->ocur == XML_ELEMENT_CONTENT_MULT))) {
6647 cur->c2->ocur = XML_ELEMENT_CONTENT_ONCE;
6653 ret->ocur = XML_ELEMENT_CONTENT_MULT;
6716 xmlElementContentPtr *
result) {
6719 int inputid = ctxt->input->id;
6726 "xmlParseElementContentDecl : %s '(' expected\n",
name);
6734 if (
CMP7(
CUR_PTR,
'#',
'P',
'C',
'D',
'A',
'T',
'A')) {
6736 res = XML_ELEMENT_TYPE_MIXED;
6739 res = XML_ELEMENT_TYPE_ELEMENT;
6767 if ((
CUR !=
'<') || (
NXT(1) !=
'!'))
6772 if (
CMP7(
CUR_PTR,
'E',
'L',
'E',
'M',
'E',
'N',
'T')) {
6773 int inputid = ctxt->input->id;
6778 "Space required after 'ELEMENT'\n");
6784 "xmlParseElementDecl: no name for Element\n");
6789 "Space required after the element name\n");
6796 ret = XML_ELEMENT_TYPE_EMPTY;
6797 }
else if ((
RAW ==
'A') && (
NXT(1) ==
'N') &&
6803 ret = XML_ELEMENT_TYPE_ANY;
6804 }
else if (
RAW ==
'(') {
6810 if ((
RAW ==
'%') && (ctxt->external == 0) &&
6811 (ctxt->inputNr == 1)) {
6813 "PEReference: forbidden within markup decl in internal subset\n");
6816 "xmlParseElementDecl: 'EMPTY', 'ANY' or '(' expected\n");
6829 if (inputid != ctxt->input->id) {
6831 "Element declaration doesn't start and stop in"
6832 " the same entity\n");
6836 if ((ctxt->sax !=
NULL) && (!ctxt->disableSAX) &&
6837 (ctxt->sax->elementDecl !=
NULL)) {
6840 ctxt->sax->elementDecl(ctxt->userData,
name,
ret,
6874 int *inputIds =
NULL;
6875 size_t inputIdsSize = 0;
6879 if ((
RAW ==
'<') && (
NXT(1) ==
'!') && (
NXT(2) ==
'[')) {
6880 int id = ctxt->input->id;
6885 if (
CMP7(
CUR_PTR,
'I',
'N',
'C',
'L',
'U',
'D',
'E')) {
6893 if (ctxt->input->id !=
id) {
6895 "All markup of the conditional section is"
6896 " not in the same entity\n");
6900 if (inputIdsSize <=
depth) {
6903 inputIdsSize = (inputIdsSize == 0 ? 4 : inputIdsSize * 2);
6905 inputIdsSize *
sizeof(
int));
6914 }
else if (
CMP6(
CUR_PTR,
'I',
'G',
'N',
'O',
'R',
'E')) {
6915 size_t ignoreDepth = 0;
6924 if (ctxt->input->id !=
id) {
6926 "All markup of the conditional section is"
6927 " not in the same entity\n");
6932 if ((
RAW ==
'<') && (
NXT(1) ==
'!') && (
NXT(2) ==
'[')) {
6936 if (ignoreDepth == 0) {
6940 }
else if ((
RAW ==
']') && (
NXT(1) ==
']') &&
6942 if (ignoreDepth == 0)
6955 if (ctxt->input->id !=
id) {
6957 "All markup of the conditional section is"
6958 " not in the same entity\n");
6966 }
else if ((
depth > 0) &&
6967 (
RAW ==
']') && (
NXT(1) ==
']') && (
NXT(2) ==
'>')) {
6969 if (ctxt->input->id != inputIds[
depth]) {
6971 "All markup of the conditional section is not"
6972 " in the same entity\n");
6975 }
else if ((
RAW ==
'<') && ((
NXT(1) ==
'!') || (
NXT(1) ==
'?'))) {
7023 if (
NXT(1) ==
'!') {
7028 else if (
NXT(3) ==
'N')
7047 }
else if (
NXT(1) ==
'?') {
7089 oldstate = ctxt->instate;
7094 "Space needed after '<?xml'\n");
7106 "Space needed here\n");
7109 ctxt->input->version =
version;
7121 ctxt->instate = oldstate;
7126 if ((
RAW ==
'?') && (
NXT(1) ==
'>')) {
7128 }
else if (
RAW ==
'>') {
7136 while ((
c =
CUR) != 0) {
7144 ctxt->instate = oldstate;
7176 if (ctxt->myDoc ==
NULL) {
7177 ctxt->myDoc = xmlNewDoc(
BAD_CAST "1.0");
7178 if (ctxt->myDoc ==
NULL) {
7182 ctxt->myDoc->properties = XML_DOC_INTERNAL;
7184 if ((ctxt->myDoc !=
NULL) && (ctxt->myDoc->intSubset ==
NULL))
7185 xmlCreateIntSubset(ctxt->myDoc,
NULL, ExternalID, SystemID);
7192 if ((
RAW ==
'<') && (
NXT(1) ==
'!') && (
NXT(2) ==
'[')) {
7194 }
else if ((
RAW ==
'<') && ((
NXT(1) ==
'!') || (
NXT(1) ==
'?'))) {
7241 if (
NXT(1) ==
'#') {
7254 if ((ctxt->sax !=
NULL) && (ctxt->sax->characters !=
NULL) &&
7255 (!ctxt->disableSAX))
7256 ctxt->sax->characters(ctxt->userData,
out,
i);
7264 if (ent ==
NULL)
return;
7265 if (!ctxt->wellFormed)
7270 if ((ent->name ==
NULL) ||
7277 if ((ctxt->sax !=
NULL) && (ctxt->sax->characters !=
NULL) &&
7278 (!ctxt->disableSAX))
7329 unsigned long oldsizeentcopy = ctxt->sizeentcopy;
7337 if (ctxt->userData == ctxt)
7340 user_data = ctxt->userData;
7343 ctxt->sizeentcopy = 0;
7368 user_data, ctxt->depth, ent->URI,
7369 ent->ExternalID, &
list);
7374 "invalid entity type found\n",
NULL);
7377 ent->flags &= ~XML_ENT_EXPANDING;
7379 ent->expandedSize = ctxt->sizeentcopy;
7382 xmlFreeNodeList(
list);
7386 xmlFreeNodeList(
list);
7391 ent->children =
list;
7396 if ((ctxt->replaceEntities == 0) ||
7398 ((
list->type == XML_TEXT_NODE) &&
7402 list->parent = (xmlNodePtr) ent;
7403 if (
list->doc != ent->doc)
7404 xmlSetTreeDoc(
list, ent->doc);
7413 list->parent = (xmlNodePtr) ctxt->node;
7414 list->doc = ctxt->myDoc;
7419 list = ent->children;
7420#ifdef LIBXML_LEGACY_ENABLED
7422 xmlAddEntityReference(ent,
list,
NULL);
7428 "Entity '%s' failed to parse\n", ent->name);
7429 if (ent->content !=
NULL)
7430 ent->content[0] = 0;
7432 xmlFreeNodeList(
list);
7445 if (ent->children ==
NULL) {
7452 if (was_checked != 0) {
7459 if (ctxt->userData == ctxt)
7462 user_data = ctxt->userData;
7467 ent->content, user_data,
NULL);
7469 }
else if (ent->etype ==
7471 unsigned long oldsizeentities = ctxt->sizeentities;
7475 ctxt->sax, user_data, ctxt->depth,
7476 ent->URI, ent->ExternalID,
NULL);
7480 ctxt->sizeentities = oldsizeentities;
7484 "invalid entity type found\n",
NULL);
7493 if ((ctxt->sax !=
NULL) && (ctxt->sax->reference !=
NULL) &&
7494 (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) {
7499 ctxt->sax->reference(ctxt->userData, ent->name);
7508 if ((was_checked != 0) &&
7515 if ((ctxt->sax !=
NULL) && (ctxt->sax->reference !=
NULL) &&
7516 (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) {
7520 ctxt->sax->reference(ctxt->userData, ent->name);
7524 if (ctxt->replaceEntities) {
7538 if (ctxt->node !=
NULL) {
7544 if (((
list ==
NULL) && (ent->owner == 0)) ||
7555 cur = ent->children;
7557 nw = xmlDocCopyNode(
cur, ctxt->myDoc, 1);
7559 if (nw->_private ==
NULL)
7560 nw->_private =
cur->_private;
7561 if (firstChild ==
NULL){
7564 nw = xmlAddChild(ctxt->node, nw);
7566 if (
cur == ent->last) {
7573 (nw->type == XML_ELEMENT_NODE) &&
7574 (nw->children ==
NULL))
7581#ifdef LIBXML_LEGACY_ENABLED
7583 xmlAddEntityReference(ent, firstChild, nw);
7585 }
else if ((
list ==
NULL) || (ctxt->inputNr > 0)) {
7595 cur = ent->children;
7596 ent->children =
NULL;
7603 nw = xmlDocCopyNode(
cur, ctxt->myDoc, 1);
7605 if (nw->_private ==
NULL)
7606 nw->_private =
cur->_private;
7607 if (firstChild ==
NULL){
7610 xmlAddChild((xmlNodePtr) ent, nw);
7612 xmlAddChild(ctxt->node,
cur);
7617 if (ent->owner == 0)
7619#ifdef LIBXML_LEGACY_ENABLED
7621 xmlAddEntityReference(ent, firstChild, nw);
7633 if (ent->children->type == XML_TEXT_NODE)
7634 ent->children->name = nbktext;
7635 if ((ent->last != ent->children) &&
7636 (ent->last->type == XML_TEXT_NODE))
7637 ent->last->name = nbktext;
7638 xmlAddChildList(ctxt->node, ent->children);
7685 xmlEntityPtr ent =
NULL;
7697 "xmlParseEntityRef: no name\n");
7719 if (ctxt->sax !=
NULL) {
7720 if (ctxt->sax->getEntity !=
NULL)
7721 ent = ctxt->sax->getEntity(ctxt->userData,
name);
7722 if ((ctxt->wellFormed == 1 ) && (ent ==
NULL) &&
7725 if ((ctxt->wellFormed == 1 ) && (ent ==
NULL) &&
7726 (ctxt->userData==ctxt)) {
7754 if ((ctxt->standalone == 1) ||
7755 ((ctxt->hasExternalSubset == 0) &&
7756 (ctxt->hasPErefs == 0))) {
7758 "Entity '%s' not defined\n",
name);
7761 "Entity '%s' not defined\n",
name);
7762 if ((ctxt->inSubset == 0) &&
7763 (ctxt->sax !=
NULL) &&
7764 (ctxt->disableSAX == 0) &&
7765 (ctxt->sax->reference !=
NULL)) {
7766 ctxt->sax->reference(ctxt->userData,
name);
7779 "Entity reference to unparsed entity %s\n",
name);
7790 "Attribute references external entity '%s'\n",
name);
7801 if ((ent->content !=
NULL) && (
xmlStrchr(ent->content,
'<')))
7807 "'<' in entity '%s' is not allowed in attributes "
7815 switch (ent->etype) {
7819 "Attempt to reference the parameter entity '%s'\n",
7872 xmlEntityPtr ent =
NULL;
7885 "xmlParseStringEntityRef: no name\n");
7914 if (ctxt->sax !=
NULL) {
7915 if (ctxt->sax->getEntity !=
NULL)
7916 ent = ctxt->sax->getEntity(ctxt->userData,
name);
7919 if ((ent ==
NULL) && (ctxt->userData==ctxt)) {
7950 if ((ctxt->standalone == 1) ||
7951 ((ctxt->hasExternalSubset == 0) &&
7952 (ctxt->hasPErefs == 0))) {
7954 "Entity '%s' not defined\n",
name);
7957 "Entity '%s' not defined\n",
7970 "Entity reference to unparsed entity %s\n",
name);
7981 "Attribute references external entity '%s'\n",
name);
7992 if ((ent->content !=
NULL) && (
xmlStrchr(ent->content,
'<')))
7998 "'<' in entity '%s' is not allowed in attributes "
8006 switch (ent->etype) {
8010 "Attempt to reference the parameter entity '%s'\n",
8067 xmlParserInputPtr
input;
8079 "PEReference: %s\n",
name);
8090 if ((ctxt->sax !=
NULL) &&
8091 (ctxt->sax->getParameterEntity !=
NULL))
8092 entity = ctxt->sax->getParameterEntity(ctxt->userData,
name);
8104 if ((ctxt->standalone == 1) ||
8105 ((ctxt->hasExternalSubset == 0) &&
8106 (ctxt->hasPErefs == 0))) {
8108 "PEReference: %%%s; not found\n",
8118 if ((ctxt->validate) && (ctxt->vctxt.error !=
NULL)) {
8120 "PEReference: %%%s; not found\n",
8124 "PEReference: %%%s; not found\n",
8135 "Internal: %%%s; is not a parameter entity\n",
8138 unsigned long parentConsumed;
8139 xmlEntityPtr oldEnt;
8146 (ctxt->replaceEntities == 0) &&
8147 (ctxt->validate == 0))
8157 parentConsumed = ctxt->input->parentConsumed;
8158 oldEnt = ctxt->input->entity;
8159 if ((oldEnt ==
NULL) ||
8164 ctxt->input->cur - ctxt->input->base);
8175 input->parentConsumed = parentConsumed;
8187 ctxt->hasPErefs = 1;
8203 xmlParserInputPtr oldinput,
input =
NULL;
8204 xmlParserInputPtr *oldinputTab;
8208 int oldinputNr, oldinputMax, oldprogressive;
8217 "xmlLoadEntityContent parameter error");
8223 "Reading %s entity content input\n",
entity->
name);
8226 (
char *)
entity->ExternalID, ctxt);
8229 "xmlLoadEntityContent input error");
8233 oldinput = ctxt->input;
8234 oldinputNr = ctxt->inputNr;
8235 oldinputMax = ctxt->inputMax;
8236 oldinputTab = ctxt->inputTab;
8237 oldencoding = ctxt->encoding;
8238 oldprogressive = ctxt->progressive;
8243 ctxt->encoding =
NULL;
8244 ctxt->progressive = 0;
8245 ctxt->inputTab =
xmlMalloc(
sizeof(xmlParserInputPtr));
8246 if (ctxt->inputTab ==
NULL) {
8269 "Version mismatch between document and entity\n");
8304 "xmlLoadEntityContent: invalid char value %d\n",
8318 while (ctxt->inputNr > 0)
8323 ctxt->input = oldinput;
8324 ctxt->inputNr = oldinputNr;
8325 ctxt->inputMax = oldinputMax;
8326 ctxt->inputTab = oldinputTab;
8327 ctxt->encoding = oldencoding;
8328 ctxt->progressive = oldprogressive;
8382 "xmlParseStringPEReference: no name\n");
8398 if ((ctxt->sax !=
NULL) &&
8399 (ctxt->sax->getParameterEntity !=
NULL))
8400 entity = ctxt->sax->getParameterEntity(ctxt->userData,
name);
8415 if ((ctxt->standalone == 1) ||
8416 ((ctxt->hasExternalSubset == 0) && (ctxt->hasPErefs == 0))) {
8418 "PEReference: %%%s; not found\n",
name);
8428 "PEReference: %%%s; not found\n",
8439 "%%%s; is not a parameter entity\n",
8443 ctxt->hasPErefs = 1;
8484 "xmlParseDocTypeDecl : no DOCTYPE name !\n");
8486 ctxt->intSubName =
name;
8495 if ((URI !=
NULL) || (ExternalID !=
NULL)) {
8496 ctxt->hasExternalSubset = 1;
8498 ctxt->extSubURI = URI;
8499 ctxt->extSubSystem = ExternalID;
8506 if ((ctxt->sax !=
NULL) && (ctxt->sax->internalSubset !=
NULL) &&
8507 (!ctxt->disableSAX))
8508 ctxt->sax->internalSubset(ctxt->userData,
name, ExternalID, URI);
8543 int baseInputNr = ctxt->inputNr;
8552 while (((
RAW !=
']') || (ctxt->inputNr > baseInputNr)) &&
8559 if ((ctxt->inputNr > 1) && (ctxt->input->filename !=
NULL) &&
8560 (
RAW ==
'<') && (
NXT(1) ==
'!') && (
NXT(2) ==
'[')) {
8562 }
else if ((
RAW ==
'<') && ((
NXT(1) ==
'!') || (
NXT(1) ==
'?'))) {
8564 }
else if (
RAW ==
'%') {
8568 "xmlParseInternalSubset: error detected in"
8569 " Markup declaration\n");
8593#ifdef LIBXML_SAX1_ENABLED
8630xmlParseAttribute(xmlParserCtxtPtr ctxt,
xmlChar **
value) {
8639 "error parsing attribute name\n");
8654 "Specification mandates value for attribute %s\n",
name);
8666 "Malformed value for xml:lang : %s\n",
8681"Invalid value \"%s\" for xml:space : \"default\" or \"preserve\" expected\n",
8720xmlParseStartTag(xmlParserCtxtPtr ctxt) {
8726 int maxatts = ctxt->maxatts;
8735 "xmlParseStartTag: invalid element name\n");
8747 while (((
RAW !=
'>') &&
8748 ((
RAW !=
'/') || (
NXT(1) !=
'>')) &&
8750 attname = xmlParseAttribute(ctxt, &attvalue);
8751 if (attname ==
NULL) {
8753 "xmlParseStartTag: problem parsing attributes\n");
8756 if (attvalue !=
NULL) {
8762 for (
i = 0;
i < nbatts;
i += 2) {
8778 if (attvalue !=
NULL)
8783 ctxt->maxatts = maxatts;
8784 }
else if (nbatts + 4 > maxatts) {
8789 maxatts *
sizeof(
const xmlChar *));
8792 if (attvalue !=
NULL)
8798 ctxt->maxatts = maxatts;
8800 atts[nbatts++] = attname;
8801 atts[nbatts++] = attvalue;
8805 if (attvalue !=
NULL)
8812 if ((
RAW ==
'>') || (((
RAW ==
'/') && (
NXT(1) ==
'>'))))
8816 "attributes construct error\n");
8825 if ((ctxt->sax !=
NULL) && (ctxt->sax->startElement !=
NULL) &&
8826 (!ctxt->disableSAX)) {
8828 ctxt->sax->startElement(ctxt->userData,
name,
atts);
8830 ctxt->sax->startElement(ctxt->userData,
name,
NULL);
8835 for (
i = 1;
i < nbatts;
i+=2)
8858xmlParseEndTag1(xmlParserCtxtPtr ctxt,
int line) {
8862 if ((
RAW !=
'<') || (
NXT(1) !=
'/')) {
8864 "xmlParseEndTag: '</' not found\n");
8890 "Opening and ending tag mismatch: %s line %d and %s\n",
8897 if ((ctxt->sax !=
NULL) && (ctxt->sax->endElement !=
NULL) &&
8898 (!ctxt->disableSAX))
8899 ctxt->sax->endElement(ctxt->userData, ctxt->name);
8922xmlParseEndTag(xmlParserCtxtPtr ctxt) {
8923 xmlParseEndTag1(ctxt, 0);
8950 int start, isNCName = 0;
8961 if (
l.name !=
NULL) {
8969 if ((
l.name ==
NULL) || (
CUR ==
':')) {
8976 if ((isNCName == 0) && (
CUR !=
':'))
8986 "Failed to parse QName '%s'\n",
l.name,
NULL,
NULL);
9042 in = ctxt->input->cur;
9045 while (*
in != 0 && *
in == *
cmp) {
9049 if ((*
cmp == 0) && (*
in ==
':')) {
9052 while (*
in != 0 && *
in == *
cmp) {
9058 ctxt->input->col +=
in - ctxt->input->cur;
9059 ctxt->input->cur =
in;
9108#define GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end) \
9109 const xmlChar *oldbase = ctxt->input->base;\
9111 if (ctxt->instate == XML_PARSER_EOF)\
9113 if (oldbase != ctxt->input->base) {\
9114 ptrdiff_t delta = ctxt->input->base - oldbase;\
9115 start = start + delta;\
9118 end = ctxt->input->end;
9134 line = ctxt->input->line;
9135 col = ctxt->input->col;
9136 if (*
in !=
'"' && *
in !=
'\'') {
9149 end = ctxt->input->end;
9159 ((*
in == 0x20) || (*
in == 0x9) ||
9160 (*
in == 0xA) || (*
in == 0xD))) {
9172 "AttValue length too long\n");
9178 (*
in <= 0x7f) && (*
in !=
'&') && (*
in !=
'<')) {
9180 if ((*
in++ == 0x20) && (*
in == 0x20))
break;
9185 "AttValue length too long\n");
9196 ((*
in == 0x20) || (*
in == 0x9) ||
9197 (*
in == 0xA) || (*
in == 0xD))) {
9205 const xmlChar *oldbase = ctxt->input->base;
9209 if (oldbase != ctxt->input->base) {
9210 ptrdiff_t delta = ctxt->input->base - oldbase;
9215 end = ctxt->input->end;
9218 "AttValue length too long\n");
9225 "AttValue length too long\n");
9228 if (*
in !=
limit)
goto need_complex;
9231 (*
in <= 0x7f) && (*
in !=
'&') && (*
in !=
'<')) {
9238 "AttValue length too long\n");
9246 "AttValue length too long\n");
9249 if (*
in !=
limit)
goto need_complex;
9262 ctxt->input->line =
line;
9263 ctxt->input->col = col;
9301 "error parsing attribute name\n");
9313 if (ctxt->attsSpecial !=
NULL) {
9346 if ((val2 !=
NULL) && (val2 !=
val)) {
9355 "Specification mandates value for attribute %s\n",
9360 if (
prefix == ctxt->str_xml) {
9370 "Malformed value for xml:lang : %s\n",
9371 internal_val,
NULL);
9386 "Invalid value \"%s\" for xml:space : \"default\" or \"preserve\" expected\n",
9387 internal_val,
NULL);
9415 const xmlChar *
uri,
unsigned hashValue,
int aindex) {
9420 hindex = hashValue & (
size - 1);
9421 bucket = &
table[hindex];
9423 while (bucket->
index >= 0) {
9431 (
uri == ctxt->nsTab[nsIndex * 2 + 1]))
9432 return(bucket->
index);
9437 if (hindex >=
size) {
9443 bucket->
index = aindex;
9479 const xmlChar **URI,
int *nbNsPtr) {
9491 unsigned attrHashSize = 0;
9492 int maxatts = ctxt->maxatts;
9493 int nratts, nbatts, nbdef, inputid;
9494 int i,
j, nbNs, nbTotalDef, attval, nsIndex, maxAtts;
9500 inputid = ctxt->input->id;
9516 "StartTag: invalid element name\n");
9519 localname = hlocalname.
name;
9554 while (((
RAW !=
'>') &&
9555 ((
RAW !=
'/') || (
NXT(1) !=
'>')) &&
9560 &haprefix, &attvalue, &
len,
9564 "xmlParseStartTag: problem parsing attributes\n");
9567 if (attvalue ==
NULL)
9569 attname = hattname.
name;
9570 aprefix = haprefix.
name;
9573 if ((attname == ctxt->str_xmlns) && (aprefix ==
NULL)) {
9585 if (parsedUri ==
NULL) {
9587 "xmlns: '%s' is not a valid URI\n",
9592 "xmlns: URI %s is not absolute\n",
9597 if (
uri == ctxt->str_xml_ns) {
9598 if (attname != ctxt->str_xml) {
9600 "xml namespace URI cannot be the default namespace\n",
9607 BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
9609 "reuse of the xmlns namespace name is forbidden\n",
9617 }
else if (aprefix == ctxt->str_xmlns) {
9628 if (attname == ctxt->str_xml) {
9629 if (
uri != ctxt->str_xml_ns) {
9631 "xml namespace prefix mapped to wrong URI\n",
9639 if (
uri == ctxt->str_xml_ns) {
9640 if (attname != ctxt->str_xml) {
9642 "xml namespace URI mapped to wrong prefix\n",
9647 if (attname == ctxt->str_xmlns) {
9649 "redefinition of the xmlns prefix is forbidden\n",
9655 BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
9657 "reuse of the xmlns namespace name is forbidden\n",
9663 "xmlns:%s: Empty XML namespace is not allowed\n",
9668 if (parsedUri ==
NULL) {
9670 "xmlns:%s: '%s' is not a valid URI\n",
9673 if ((ctxt->pedantic) && (parsedUri->
scheme ==
NULL)) {
9675 "xmlns:%s: URI %s is not absolute\n",
9689 if ((
atts ==
NULL) || (nbatts + 5 > maxatts)) {
9693 maxatts = ctxt->maxatts;
9696 ctxt->attallocs[nratts++] = (hattname.
hashValue & 0x7FFFFFFF) |
9697 ((
unsigned)
alloc << 31);
9698 atts[nbatts++] = attname;
9699 atts[nbatts++] = aprefix;
9702 atts[nbatts++] = attvalue;
9704 atts[nbatts++] = attvalue;
9718 if (
alloc != 0) attval = 1;
9723 if ((attvalue !=
NULL) && (
alloc != 0)) {
9731 if ((
RAW ==
'>') || (((
RAW ==
'/') && (
NXT(1) ==
'>'))))
9735 "attributes construct error\n");
9741 if (ctxt->input->id != inputid) {
9743 "Unexpected change of input\n");
9751 if (ctxt->attsDefault !=
NULL) {
9762 if ((attname == ctxt->str_xmlns) && (aprefix ==
NULL)) {
9767 }
else if (aprefix == ctxt->str_xmlns) {
9783 for (
i = 0;
i < nbatts;
i += 5) {
9785 aprefix =
atts[
i+1];
9790 if (aprefix ==
NULL) {
9792 }
else if (aprefix == ctxt->str_xml) {
9795 haprefix.
name = aprefix;
9800 "Namespace prefix %s for %s on %s is not defined\n",
9801 aprefix, attname, localname);
9812 maxAtts = nratts + nbTotalDef;
9819 while (attrHashSize / 2 < (
unsigned) maxAtts)
9822 if (attrHashSize > ctxt->attrHashMax) {
9825 tmp =
xmlRealloc(ctxt->attrHash, attrHashSize *
sizeof(tmp[0]));
9831 ctxt->attrHash = tmp;
9832 ctxt->attrHashMax = attrHashSize;
9835 memset(ctxt->attrHash, -1, attrHashSize *
sizeof(ctxt->attrHash[0]));
9837 for (
i = 0,
j = 0;
j < nratts;
i += 5,
j++) {
9839 unsigned hashValue, nameHashValue, uriHashValue;
9843 aprefix =
atts[
i+1];
9846 nameHashValue = ctxt->attallocs[
j] | 0x80000000;
9852 nsuri = ctxt->str_xml_ns;
9855 nsuri = ctxt->nsTab[nsIndex * 2 + 1];
9856 uriHashValue = ctxt->nsdb->extra[nsIndex].uriHashValue;
9876 "Namespaced Attribute %s in '%s' redefined\n",
9877 attname, nsuri,
NULL);
9886 if (ctxt->attsDefault !=
NULL) {
9894 unsigned hashValue, uriHashValue;
9900 if ((attname == ctxt->str_xmlns) && (aprefix ==
NULL))
9902 if (aprefix == ctxt->str_xmlns)
9905 if (aprefix ==
NULL) {
9909 }
if (aprefix == ctxt->str_xml) {
9911 nsuri = ctxt->str_xml_ns;
9913 }
else if (aprefix !=
NULL) {
9917 "Namespace prefix %s for %s on %s is not "
9919 aprefix, attname, localname);
9924 nsuri = ctxt->nsTab[nsIndex * 2 + 1];
9925 uriHashValue = ctxt->nsdb->extra[nsIndex].uriHashValue;
9943 "Namespaced Attribute %s in '%s' redefined\n",
9944 attname, nsuri,
NULL);
9950 if ((
atts ==
NULL) || (nbatts + 5 > maxatts)) {
9955 maxatts = ctxt->maxatts;
9959 atts[nbatts++] = attname;
9960 atts[nbatts++] = aprefix;
9964 if ((ctxt->standalone == 1) && (
attr->external != 0)) {
9966 "standalone: attribute %s on %s defaulted "
9967 "from external subset\n",
9968 attname, localname);
9978 for (
i = 0,
j = 0;
i < nbatts;
i += 5,
j++) {
9983 else if (nsIndex ==
INT_MAX - 1)
9984 atts[
i+2] = ctxt->str_xml_ns;
9986 atts[
i+2] = ctxt->nsTab[nsIndex * 2 + 1];
9988 if ((
j < nratts) && (ctxt->attallocs[
j] & 0x80000000) == 0) {
9997 "Namespace prefix %s on %s is not defined\n",
10006 if ((ctxt->sax !=
NULL) && (ctxt->sax->startElementNs !=
NULL) &&
10007 (!ctxt->disableSAX)) {
10009 ctxt->sax->startElementNs(ctxt->userData, localname,
prefix,
uri,
10010 nbNs, ctxt->nsTab + 2 * (ctxt->nsNr - nbNs),
10011 nbatts / 5, nbdef,
atts);
10013 ctxt->sax->startElementNs(ctxt->userData, localname,
prefix,
uri,
10014 0,
NULL, nbatts / 5, nbdef,
atts);
10022 for (
i = 0,
j = 0;
j < nratts;
i += 5,
j++)
10023 if (ctxt->attallocs[
j] & 0x80000000)
10051 if ((
RAW !=
'<') || (
NXT(1) !=
'/')) {
10083 "Opening and ending tag mismatch: %s line %d and %s\n",
10084 ctxt->name,
tag->line,
name);
10090 if ((ctxt->sax !=
NULL) && (ctxt->sax->endElementNs !=
NULL) &&
10091 (!ctxt->disableSAX))
10092 ctxt->sax->endElementNs(ctxt->userData, ctxt->name,
tag->prefix,
10096 if (
tag->nsNr != 0)
10128 if ((
CUR !=
'<') || (
NXT(1) !=
'!') || (
NXT(2) !=
'['))
10132 if (!
CMP6(
CUR_PTR,
'C',
'D',
'A',
'T',
'A',
'['))
10156 ((
r !=
']') || (
s !=
']') || (
cur !=
'>'))) {
10171 "CData section too big found\n");
10188 "CData section not finished\n%.50s\n",
buf);
10196 if ((ctxt->sax !=
NULL) && (!ctxt->disableSAX)) {
10197 if (ctxt->sax->cdataBlock !=
NULL)
10198 ctxt->sax->cdataBlock(ctxt->userData,
buf,
len);
10199 else if (ctxt->sax->characters !=
NULL)
10200 ctxt->sax->characters(ctxt->userData,
buf,
len);
10219 int nameNr = ctxt->nameNr;
10222 while ((ctxt->input->cur < ctxt->input->end) &&
10229 if ((*
cur ==
'<') && (
cur[1] ==
'?')) {
10237 else if (
CMP9(
CUR_PTR,
'<',
'!',
'[',
'C',
'D',
'A',
'T',
'A',
'[')) {
10244 else if ((*
cur ==
'<') && (
NXT(1) ==
'!') &&
10245 (
NXT(2) ==
'-') && (
NXT(3) ==
'-')) {
10253 else if (*
cur ==
'<') {
10254 if (
NXT(1) ==
'/') {
10255 if (ctxt->nameNr <= nameNr)
10268 else if (*
cur ==
'&') {
10295 int nameNr = ctxt->nameNr;
10301 (ctxt->nameNr > nameNr)) {
10302 const xmlChar *
name = ctxt->nameTab[ctxt->nameNr - 1];
10303 int line = ctxt->pushTab[ctxt->nameNr - 1].line;
10305 "Premature end of data in tag %s line %d\n",
10335 if (ctxt->input->cur >= ctxt->input->end) {
10337 const xmlChar *
name = ctxt->nameTab[ctxt->nameNr - 1];
10338 int line = ctxt->pushTab[ctxt->nameNr - 1].line;
10340 "Premature end of data in tag %s line %d\n",
10371 "Excessive depth in document: %d use XML_PARSE_HUGE option\n",
10378 if (ctxt->record_info) {
10379 node_info.
begin_pos = ctxt->input->consumed +
10380 (
CUR_PTR - ctxt->input->base);
10384 if (ctxt->spaceNr == 0)
10386 else if (*ctxt->space == -2)
10391 line = ctxt->input->line;
10392#ifdef LIBXML_SAX1_ENABLED
10396#ifdef LIBXML_SAX1_ENABLED
10398 name = xmlParseStartTag(ctxt);
10409#ifdef LIBXML_VALID_ENABLED
10415 if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc &&
10416 ctxt->node && (ctxt->node == ctxt->myDoc->children))
10417 ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
10423 if ((
RAW ==
'/') && (
NXT(1) ==
'>')) {
10426 if ((ctxt->sax !=
NULL) && (ctxt->sax->endElementNs !=
NULL) &&
10427 (!ctxt->disableSAX))
10428 ctxt->sax->endElementNs(ctxt->userData,
name,
prefix, URI);
10429#ifdef LIBXML_SAX1_ENABLED
10431 if ((ctxt->sax !=
NULL) && (ctxt->sax->endElement !=
NULL) &&
10432 (!ctxt->disableSAX))
10433 ctxt->sax->endElement(ctxt->userData,
name);
10440 if (
cur !=
NULL && ctxt->record_info) {
10442 node_info.
end_pos = ctxt->input->consumed +
10443 (
CUR_PTR - ctxt->input->base);
10444 node_info.
end_line = ctxt->input->line;
10451 if (
cur !=
NULL && ctxt->record_info) {
10459 "Couldn't find end of Start Tag %s line %d\n",
10484 xmlNodePtr
cur = ctxt->node;
10486 if (ctxt->nameNr <= 0) {
10487 if ((
RAW ==
'<') && (
NXT(1) ==
'/'))
10499#ifdef LIBXML_SAX1_ENABLED
10501 xmlParseEndTag1(ctxt, 0);
10507 if (
cur !=
NULL && ctxt->record_info) {
10511 if (node_info !=
NULL) {
10512 node_info->
end_pos = ctxt->input->consumed +
10513 (
CUR_PTR - ctxt->input->base);
10514 node_info->
end_line = ctxt->input->line;
10546 if (!((
cur >=
'0') && (
cur <=
'9'))) {
10560 while ((
cur >=
'0') && (
cur <=
'9')) {
10600 if (
CMP7(
CUR_PTR,
'v',
'e',
'r',
's',
'i',
'o',
'n')) {
10616 }
else if (
RAW ==
'\''){
10653 if (((
cur >=
'a') && (
cur <=
'z')) ||
10654 ((
cur >=
'A') && (
cur <=
'Z'))) {
10664 while (((
cur >=
'a') && (
cur <=
'z')) ||
10665 ((
cur >=
'A') && (
cur <=
'Z')) ||
10666 ((
cur >=
'0') && (
cur <=
'9')) ||
10667 (
cur ==
'.') || (
cur ==
'_') ||
10717 if (
CMP8(
CUR_PTR,
'e',
'n',
'c',
'o',
'd',
'i',
'n',
'g') == 0)
10737 }
else if (
RAW ==
'\''){
10750 if (encoding ==
NULL)
10755 return(ctxt->encoding);
10793 int standalone = -2;
10796 if (
CMP10(
CUR_PTR,
's',
't',
'a',
'n',
'd',
'a',
'l',
'o',
'n',
'e')) {
10801 return(standalone);
10807 if ((
RAW ==
'n') && (
NXT(1) ==
'o')) {
10810 }
else if ((
RAW ==
'y') && (
NXT(1) ==
'e') &&
10821 }
else if (
RAW ==
'"'){
10823 if ((
RAW ==
'n') && (
NXT(1) ==
'o')) {
10826 }
else if ((
RAW ==
'y') && (
NXT(1) ==
'e') &&
10841 return(standalone);
10865 ctxt->standalone = -2;
10874 "Blank needed after '<?xml'\n");
10891 "Unsupported version '%s'\n",
10896 "Unsupported version '%s'\n",
10900 "Unsupported version '%s'\n",
10905 if (ctxt->version !=
NULL)
10906 xmlFree((
void *) ctxt->version);
10914 if ((
RAW ==
'?') && (
NXT(1) ==
'>')) {
10933 if ((
RAW ==
'?') && (
NXT(1) ==
'>')) {
10949 if ((
RAW ==
'?') && (
NXT(1) ==
'>')) {
10951 }
else if (
RAW ==
'>') {
10959 while ((
c =
CUR) != 0) {
10983 if ((
RAW ==
'<') && (
NXT(1) ==
'?')) {
11012 if ((ctxt ==
NULL) || (ctxt->input ==
NULL))
11025 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
11055 if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
11056 ctxt->sax->startDocument(ctxt->userData);
11059 if ((ctxt->myDoc !=
NULL) && (ctxt->input !=
NULL) &&
11060 (ctxt->input->buf !=
NULL) && (ctxt->input->buf->compressed >= 0)) {
11061 ctxt->myDoc->compression = ctxt->input->buf->compressed;
11074 if (
CMP9(
CUR_PTR,
'<',
'!',
'D',
'O',
'C',
'T',
'Y',
'P',
'E')) {
11076 ctxt->inSubset = 1;
11088 ctxt->inSubset = 2;
11089 if ((ctxt->sax !=
NULL) && (ctxt->sax->externalSubset !=
NULL) &&
11090 (!ctxt->disableSAX))
11091 ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName,
11092 ctxt->extSubSystem, ctxt->extSubURI);
11095 ctxt->inSubset = 0;
11109 "Start tag expected, '<' not found\n");
11121 if (ctxt->input->cur < ctxt->input->end) {
11124 }
else if ((ctxt->input->buf !=
NULL) &&
11125 (ctxt->input->buf->encoder !=
NULL) &&
11128 "Truncated multi-byte sequence at EOF\n");
11136 if ((ctxt->sax) && (ctxt->sax->endDocument !=
NULL))
11137 ctxt->sax->endDocument(ctxt->userData);
11142 if ((ctxt->myDoc !=
NULL) &&
11144 xmlFreeDoc(ctxt->myDoc);
11145 ctxt->myDoc =
NULL;
11148 if ((ctxt->wellFormed) && (ctxt->myDoc !=
NULL)) {
11149 ctxt->myDoc->properties |= XML_DOC_WELLFORMED;
11151 ctxt->myDoc->properties |= XML_DOC_DTDVALID;
11152 if (ctxt->nsWellFormed)
11153 ctxt->myDoc->properties |= XML_DOC_NSVALID;
11155 ctxt->myDoc->properties |= XML_DOC_OLD10;
11157 if (! ctxt->wellFormed) {
11180 if ((ctxt ==
NULL) || (ctxt->input ==
NULL))
11188 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
11217 if ((ctxt->sax) && (ctxt->sax->startDocument) && (!ctxt->disableSAX))
11218 ctxt->sax->startDocument(ctxt->userData);
11226 ctxt->validate = 0;
11227 ctxt->loadsubset = 0;
11234 if ((
RAW ==
'<') && (
NXT(1) ==
'/')) {
11236 }
else if (
RAW != 0) {
11243 if ((ctxt->sax) && (ctxt->sax->endDocument !=
NULL))
11244 ctxt->sax->endDocument(ctxt->userData);
11246 if (! ctxt->wellFormed)
return(-1);
11250#ifdef LIBXML_PUSH_ENABLED
11265xmlParseLookupChar(xmlParserCtxtPtr ctxt,
int c) {
11268 if (ctxt->checkIndex == 0) {
11269 cur = ctxt->input->cur + 1;
11271 cur = ctxt->input->cur + ctxt->checkIndex;
11275 size_t index = ctxt->input->end - ctxt->input->cur;
11278 ctxt->checkIndex = 0;
11281 ctxt->checkIndex =
index;
11284 ctxt->checkIndex = 0;
11299xmlParseLookupString(xmlParserCtxtPtr ctxt,
size_t startDelta,
11300 const char *
str,
size_t strLen) {
11303 if (ctxt->checkIndex == 0) {
11304 cur = ctxt->input->cur + startDelta;
11306 cur = ctxt->input->cur + ctxt->checkIndex;
11310 if (term ==
NULL) {
11315 if ((
size_t) (
end -
cur) < strLen)
11321 ctxt->checkIndex = 0;
11322 return(ctxt->input->end - strLen);
11324 ctxt->checkIndex =
index;
11326 ctxt->checkIndex = 0;
11339xmlParseLookupCharData(xmlParserCtxtPtr ctxt) {
11340 const xmlChar *
cur = ctxt->input->cur + ctxt->checkIndex;
11345 if ((*
cur ==
'<') || (*
cur ==
'&')) {
11346 ctxt->checkIndex = 0;
11354 ctxt->checkIndex = 0;
11357 ctxt->checkIndex =
index;
11369xmlParseLookupGt(xmlParserCtxtPtr ctxt) {
11372 int state = ctxt->endCheckState;
11375 if (ctxt->checkIndex == 0)
11376 cur = ctxt->input->cur + 1;
11378 cur = ctxt->input->cur + ctxt->checkIndex;
11384 }
else if (*
cur ==
'\'' || *
cur ==
'"') {
11386 }
else if (*
cur ==
'>') {
11387 ctxt->checkIndex = 0;
11388 ctxt->endCheckState = 0;
11396 ctxt->checkIndex = 0;
11397 ctxt->endCheckState = 0;
11400 ctxt->checkIndex =
index;
11401 ctxt->endCheckState =
state;
11413xmlParseLookupInternalSubset(xmlParserCtxtPtr ctxt) {
11423 int state = ctxt->endCheckState;
11426 if (ctxt->checkIndex == 0) {
11427 cur = ctxt->input->cur + 1;
11429 cur = ctxt->input->cur + ctxt->checkIndex;
11434 if (
state ==
'-') {
11435 if ((*
cur ==
'-') &&
11444 else if (
state ==
']') {
11446 ctxt->checkIndex = 0;
11447 ctxt->endCheckState = 0;
11452 }
else if (*
cur !=
']') {
11458 else if (
state ==
' ') {
11460 ctxt->checkIndex = 0;
11461 ctxt->endCheckState = 0;
11470 else if (
state != 0) {
11476 else if (*
cur ==
'<') {
11477 if ((
cur[1] ==
'!') &&
11487 else if ((*
cur ==
'"') || (*
cur ==
'\'') || (*
cur ==
']')) {
11506 ctxt->checkIndex = 0;
11507 ctxt->endCheckState = 0;
11510 ctxt->checkIndex =
index;
11511 ctxt->endCheckState =
state;
11532 if ((utf ==
NULL) || (
len <= 0))
11535 for (ix = 0; ix <
len;) {
11537 if ((
c & 0x80) == 0x00) {
11540 else if ((
c == 0xA) || (
c == 0xD) || (
c == 0x9))
11544 }
else if ((
c & 0xe0) == 0xc0) {
11546 if ((utf[ix+1] & 0xc0 ) != 0x80)
11548 codepoint = (utf[ix] & 0x1f) << 6;
11549 codepoint |= utf[ix+1] & 0x3f;
11553 }
else if ((
c & 0xf0) == 0xe0) {
11555 if (((utf[ix+1] & 0xc0) != 0x80) ||
11556 ((utf[ix+2] & 0xc0) != 0x80))
11558 codepoint = (utf[ix] & 0xf) << 12;
11559 codepoint |= (utf[ix+1] & 0x3f) << 6;
11560 codepoint |= utf[ix+2] & 0x3f;
11564 }
else if ((
c & 0xf8) == 0xf0) {
11566 if (((utf[ix+1] & 0xc0) != 0x80) ||
11567 ((utf[ix+2] & 0xc0) != 0x80) ||
11568 ((utf[ix+3] & 0xc0) != 0x80))
11570 codepoint = (utf[ix] & 0x7) << 18;
11571 codepoint |= (utf[ix+1] & 0x3f) << 12;
11572 codepoint |= (utf[ix+2] & 0x3f) << 6;
11573 codepoint |= utf[ix+3] & 0x3f;
11593xmlParseTryOrFinish(xmlParserCtxtPtr ctxt,
int terminate) {
11598 if (ctxt->input ==
NULL)
11601 if ((ctxt->input !=
NULL) &&
11602 (ctxt->input->cur - ctxt->input->base > 4096)) {
11607 if ((ctxt->errNo !=
XML_ERR_OK) && (ctxt->disableSAX == 1))
11610 avail = ctxt->input->end - ctxt->input->cur;
11613 switch (ctxt->instate) {
11643 cur = ctxt->input->cur[0];
11644 next = ctxt->input->cur[1];
11645 if ((
cur ==
'<') && (
next ==
'?')) {
11648 (!xmlParseLookupString(ctxt, 2,
"?>", 2)))
11650 if ((ctxt->input->cur[2] ==
'x') &&
11651 (ctxt->input->cur[3] ==
'm') &&
11652 (ctxt->input->cur[4] ==
'l') &&
11669 if (ctxt->version ==
NULL) {
11674 if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
11675 ctxt->sax->setDocumentLocator(ctxt->userData,
11677 if ((ctxt->sax) && (ctxt->sax->startDocument) &&
11678 (!ctxt->disableSAX))
11679 ctxt->sax->startDocument(ctxt->userData);
11688 int line = ctxt->input->line;
11693 cur = ctxt->input->cur[0];
11696 "Start tag expected, '<' not found");
11698 if ((ctxt->sax) && (ctxt->sax->endDocument !=
NULL))
11699 ctxt->sax->endDocument(ctxt->userData);
11702 if ((!
terminate) && (!xmlParseLookupGt(ctxt)))
11704 if (ctxt->spaceNr == 0)
11706 else if (*ctxt->space == -2)
11710#ifdef LIBXML_SAX1_ENABLED
11714#ifdef LIBXML_SAX1_ENABLED
11716 name = xmlParseStartTag(ctxt);
11723 if ((ctxt->sax) && (ctxt->sax->endDocument !=
NULL))
11724 ctxt->sax->endDocument(ctxt->userData);
11727#ifdef LIBXML_VALID_ENABLED
11733 if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc &&
11734 ctxt->node && (ctxt->node == ctxt->myDoc->children))
11735 ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
11741 if ((
RAW ==
'/') && (
NXT(1) ==
'>')) {
11745 if ((ctxt->sax !=
NULL) &&
11746 (ctxt->sax->endElementNs !=
NULL) &&
11747 (!ctxt->disableSAX))
11748 ctxt->sax->endElementNs(ctxt->userData,
name,
11752#ifdef LIBXML_SAX1_ENABLED
11754 if ((ctxt->sax !=
NULL) &&
11755 (ctxt->sax->endElement !=
NULL) &&
11756 (!ctxt->disableSAX))
11757 ctxt->sax->endElement(ctxt->userData,
name);
11761 }
else if (
RAW ==
'>') {
11766 "Couldn't find end of Start Tag %s\n",
11776 if (ctxt->nameNr == 0)
11783 cur = ctxt->input->cur[0];
11788 next = ctxt->input->cur[1];
11793 }
else if (
next ==
'?') {
11795 (!xmlParseLookupString(ctxt, 2,
"?>", 2)))
11802 }
else if (
next ==
'!') {
11805 next = ctxt->input->cur[2];
11810 if (ctxt->input->cur[3] ==
'-') {
11812 (!xmlParseLookupString(ctxt, 4,
"-->", 3)))
11820 }
else if (
next ==
'[') {
11823 if ((ctxt->input->cur[2] ==
'[') &&
11824 (ctxt->input->cur[3] ==
'C') &&
11825 (ctxt->input->cur[4] ==
'D') &&
11826 (ctxt->input->cur[5] ==
'A') &&
11827 (ctxt->input->cur[6] ==
'T') &&
11828 (ctxt->input->cur[7] ==
'A') &&
11829 (ctxt->input->cur[8] ==
'[')) {
11836 }
else if (
cur ==
'&') {
11837 if ((!
terminate) && (!xmlParseLookupChar(ctxt,
';')))
11855 if ((!
terminate) && (!xmlParseLookupCharData(ctxt)))
11858 ctxt->checkIndex = 0;
11867 if ((!
terminate) && (!xmlParseLookupChar(ctxt,
'>')))
11873#ifdef LIBXML_SAX1_ENABLED
11875 xmlParseEndTag1(ctxt, 0);
11879 if (ctxt->nameNr == 0) {
11900 term = xmlParseLookupString(ctxt, 0,
"]]>", 3);
11903 if (term ==
NULL) {
11908 size = ctxt->input->end - ctxt->input->cur;
11912 ctxt->checkIndex = 0;
11916 tmp = xmlCheckCdataPush(ctxt->input->cur,
size, 0);
11919 ctxt->input->cur += tmp;
11920 goto encoding_error;
11922 if ((ctxt->sax !=
NULL) && (!ctxt->disableSAX)) {
11923 if (ctxt->sax->cdataBlock !=
NULL)
11924 ctxt->sax->cdataBlock(ctxt->userData,
11925 ctxt->input->cur, tmp);
11926 else if (ctxt->sax->characters !=
NULL)
11927 ctxt->sax->characters(ctxt->userData,
11928 ctxt->input->cur, tmp);
11937 tmp = xmlCheckCdataPush(ctxt->input->cur,
base, 1);
11938 if ((tmp < 0) || (tmp !=
base)) {
11940 ctxt->input->cur += tmp;
11941 goto encoding_error;
11943 if ((ctxt->sax !=
NULL) && (
base == 0) &&
11944 (ctxt->sax->cdataBlock !=
NULL) &&
11945 (!ctxt->disableSAX)) {
11951 if ((ctxt->input->cur - ctxt->input->base >= 9) &&
11952 (!
strncmp((
const char *)&ctxt->input->cur[-9],
11954 ctxt->sax->cdataBlock(ctxt->userData,
11956 }
else if ((ctxt->sax !=
NULL) && (
base > 0) &&
11957 (!ctxt->disableSAX)) {
11958 if (ctxt->sax->cdataBlock !=
NULL)
11959 ctxt->sax->cdataBlock(ctxt->userData,
11960 ctxt->input->cur,
base);
11961 else if (ctxt->sax->characters !=
NULL)
11962 ctxt->sax->characters(ctxt->userData,
11963 ctxt->input->cur,
base);
11976 avail = ctxt->input->end - ctxt->input->cur;
11979 if (ctxt->input->cur[0] ==
'<') {
11982 next = ctxt->input->cur[1];
11985 (!xmlParseLookupString(ctxt, 2,
"?>", 2)))
11991 }
else if (
next ==
'!') {
11995 if (ctxt->input->cur[2] ==
'-') {
11998 if (ctxt->input->cur[3] ==
'-') {
12000 (!xmlParseLookupString(ctxt, 4,
"-->", 3)))
12010 if ((ctxt->input->cur[2] ==
'D') &&
12011 (ctxt->input->cur[3] ==
'O') &&
12012 (ctxt->input->cur[4] ==
'C') &&
12013 (ctxt->input->cur[5] ==
'T') &&
12014 (ctxt->input->cur[6] ==
'Y') &&
12015 (ctxt->input->cur[7] ==
'P') &&
12016 (ctxt->input->cur[8] ==
'E')) {
12017 if ((!
terminate) && (!xmlParseLookupGt(ctxt)))
12019 ctxt->inSubset = 1;
12029 ctxt->inSubset = 2;
12030 if ((ctxt->sax !=
NULL) &&
12031 (!ctxt->disableSAX) &&
12032 (ctxt->sax->externalSubset !=
NULL))
12033 ctxt->sax->externalSubset(
12036 ctxt->extSubSystem,
12038 ctxt->inSubset = 0;
12054 if ((ctxt->sax) && (ctxt->sax->endDocument !=
NULL))
12055 ctxt->sax->endDocument(ctxt->userData);
12061 if ((!
terminate) && (!xmlParseLookupInternalSubset(ctxt)))
12066 ctxt->inSubset = 2;
12067 if ((ctxt->sax !=
NULL) && (!ctxt->disableSAX) &&
12068 (ctxt->sax->externalSubset !=
NULL))
12069 ctxt->sax->externalSubset(ctxt->userData, ctxt->intSubName,
12070 ctxt->extSubSystem, ctxt->extSubURI);
12071 ctxt->inSubset = 0;
12080 "PP: internal error\n");
12088 if (ctxt->input->end - ctxt->input->cur < 4) {
12090 "Input is not proper UTF-8, indicate encoding !\n",
12096 ctxt->input->cur[0], ctxt->input->cur[1],
12097 ctxt->input->cur[2], ctxt->input->cur[3]);
12099 "Input is not proper UTF-8, indicate encoding !\n%s",
12117xmlParseChunk(xmlParserCtxtPtr ctxt,
const char *
chunk,
int size,
12123 if ((ctxt->errNo !=
XML_ERR_OK) && (ctxt->disableSAX == 1))
12124 return(ctxt->errNo);
12127 if (ctxt->input ==
NULL)
12130 ctxt->progressive = 1;
12141 size_t pos = ctxt->input->cur - ctxt->input->base;
12149 return(ctxt->errNo);
12155 return(ctxt->errNo);
12157 if ((ctxt->input !=
NULL) &&
12164 if ((ctxt->errNo !=
XML_ERR_OK) && (ctxt->disableSAX == 1))
12165 return(ctxt->errNo);
12167 if ((end_in_lf == 1) && (ctxt->input !=
NULL) &&
12168 (ctxt->input->buf !=
NULL)) {
12169 size_t pos = ctxt->input->cur - ctxt->input->base;
12177 return(ctxt->errNo);
12186 if (ctxt->nameNr > 0) {
12187 const xmlChar *
name = ctxt->nameTab[ctxt->nameNr - 1];
12188 int line = ctxt->pushTab[ctxt->nameNr - 1].line;
12190 "Premature end of data in tag %s line %d\n",
12196 "Start tag expected, '<' not found\n");
12198 }
else if ((ctxt->input->buf !=
NULL) &&
12199 (ctxt->input->buf->encoder !=
NULL) &&
12202 "Truncated multi-byte sequence at EOF\n");
12205 if ((ctxt->sax) && (ctxt->sax->endDocument !=
NULL))
12206 ctxt->sax->endDocument(ctxt->userData);
12210 if (ctxt->wellFormed == 0)
12242xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
void *user_data,
12244 xmlParserCtxtPtr ctxt;
12245 xmlParserInputPtr inputStream;
12246 xmlParserInputBufferPtr
buf;
12252 if (ctxt ==
NULL) {
12257 ctxt->dictNames = 1;
12259 ctxt->directory =
NULL;
12265 if (inputStream ==
NULL) {
12272 inputStream->filename =
NULL;
12274 inputStream->filename = (
char *)
12276 if (inputStream->filename ==
NULL) {
12283 inputStream->buf =
buf;
12288 (ctxt->input !=
NULL) && (ctxt->input->buf !=
NULL)) {
12289 size_t pos = ctxt->input->cur - ctxt->input->base;
12336 xmlParserCtxtPtr ctxt;
12337 xmlParserInputPtr inputStream;
12338 xmlParserInputBufferPtr
buf;
12344 if (ioclose !=
NULL)
12350 if (ctxt ==
NULL) {
12356 if (inputStream ==
NULL) {
12365#ifdef LIBXML_VALID_ENABLED
12385xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr
input,
12388 xmlParserCtxtPtr ctxt;
12389 xmlParserInputPtr pinput =
NULL;
12395 if (ctxt ==
NULL) {
12410 if (pinput ==
NULL) {
12430 ctxt->inSubset = 2;
12431 ctxt->myDoc = xmlNewDoc(
BAD_CAST "1.0");
12432 if (ctxt->myDoc ==
NULL) {
12436 ctxt->myDoc->properties = XML_DOC_INTERNAL;
12437 ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc,
BAD_CAST "none",
12444 if (ctxt->myDoc !=
NULL) {
12445 if (ctxt->wellFormed) {
12446 ret = ctxt->myDoc->extSubset;
12447 ctxt->myDoc->extSubset =
NULL;
12452 tmp =
ret->children;
12453 while (tmp !=
NULL) {
12461 xmlFreeDoc(ctxt->myDoc);
12462 ctxt->myDoc =
NULL;
12483xmlSAXParseDTD(xmlSAXHandlerPtr sax,
const xmlChar *ExternalID,
12486 xmlParserCtxtPtr ctxt;
12490 if ((ExternalID ==
NULL) && (SystemID ==
NULL))
return(
NULL);
12493 if (ctxt ==
NULL) {
12504 if ((SystemID !=
NULL) && (systemIdCanonic ==
NULL)) {
12513 if ((ctxt->sax !=
NULL) && (ctxt->sax->resolveEntity !=
NULL))
12514 input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID,
12518 if (systemIdCanonic !=
NULL)
12528 if (systemIdCanonic !=
NULL)
12536 input->filename = (
char *) systemIdCanonic;
12543 ctxt->inSubset = 2;
12544 ctxt->myDoc = xmlNewDoc(
BAD_CAST "1.0");
12545 if (ctxt->myDoc ==
NULL) {
12550 ctxt->myDoc->properties = XML_DOC_INTERNAL;
12551 ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc,
BAD_CAST "none",
12552 ExternalID, SystemID);
12555 if (ctxt->myDoc !=
NULL) {
12556 if (ctxt->wellFormed) {
12557 ret = ctxt->myDoc->extSubset;
12558 ctxt->myDoc->extSubset =
NULL;
12563 tmp =
ret->children;
12564 while (tmp !=
NULL) {
12572 xmlFreeDoc(ctxt->myDoc);
12573 ctxt->myDoc =
NULL;
12592xmlParseDTD(
const xmlChar *ExternalID,
const xmlChar *SystemID) {
12593 return(xmlSAXParseDTD(
NULL, ExternalID, SystemID));
12631 if (
ctx->userData ==
ctx)
12634 userData =
ctx->userData;
12636 userData,
ctx->depth + 1,
12659 xmlSAXHandlerPtr sax,
12662 xmlParserCtxtPtr ctxt;
12664 xmlNodePtr newRoot;
12667 if (((
depth > 40) &&
12671 "Maximum entity nesting depth exceeded");
12685 if (oldctxt !=
NULL) {
12686 ctxt->nbErrors = oldctxt->nbErrors;
12687 ctxt->nbWarnings = oldctxt->nbWarnings;
12691 newDoc = xmlNewDoc(
BAD_CAST "1.0");
12692 if (newDoc ==
NULL) {
12696 newDoc->properties = XML_DOC_INTERNAL;
12698 newDoc->intSubset = doc->intSubset;
12699 newDoc->extSubset = doc->extSubset;
12701 newDoc->dict = doc->dict;
12704 if (doc->URL !=
NULL) {
12709 if (newRoot ==
NULL) {
12712 newDoc->intSubset =
NULL;
12713 newDoc->extSubset =
NULL;
12714 xmlFreeDoc(newDoc);
12717 xmlAddChild((xmlNodePtr) newDoc, newRoot);
12720 ctxt->myDoc = newDoc;
12723 newRoot->doc = doc;
12739 "Version mismatch between document and entity\n");
12744 ctxt->depth =
depth;
12745 if (oldctxt !=
NULL) {
12746 ctxt->_private = oldctxt->_private;
12747 ctxt->loadsubset = oldctxt->loadsubset;
12748 ctxt->validate = oldctxt->validate;
12749 ctxt->valid = oldctxt->valid;
12750 ctxt->replaceEntities = oldctxt->replaceEntities;
12751 if (oldctxt->validate) {
12752 ctxt->vctxt.error = oldctxt->vctxt.error;
12753 ctxt->vctxt.warning = oldctxt->vctxt.warning;
12754 ctxt->vctxt.userData = oldctxt->vctxt.userData;
12755 ctxt->vctxt.flags = oldctxt->vctxt.flags;
12757 ctxt->external = oldctxt->external;
12759 ctxt->dict = oldctxt->dict;
12762 ctxt->str_xml_ns =
xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36);
12763 ctxt->dictNames = oldctxt->dictNames;
12764 ctxt->attsDefault = oldctxt->attsDefault;
12765 ctxt->attsSpecial = oldctxt->attsSpecial;
12766 ctxt->linenumbers = oldctxt->linenumbers;
12767 ctxt->record_info = oldctxt->record_info;
12768 ctxt->node_seq.maximum = oldctxt->node_seq.maximum;
12769 ctxt->node_seq.length = oldctxt->node_seq.length;
12770 ctxt->node_seq.buffer = oldctxt->node_seq.buffer;
12776 ctxt->_private =
NULL;
12777 ctxt->validate = 0;
12778 ctxt->external = 2;
12779 ctxt->loadsubset = 0;
12784 if ((
RAW ==
'<') && (
NXT(1) ==
'/')) {
12786 }
else if (
RAW != 0) {
12789 if (ctxt->node != newDoc->children) {
12793 if (!ctxt->wellFormed) {
12796 oldctxt->errNo = ctxt->errNo;
12797 oldctxt->wellFormed = 0;
12808 cur = newDoc->children->children;
12814 newDoc->children->children =
NULL;
12822 if (ctxt->input !=
NULL && oldctxt !=
NULL) {
12823 unsigned long consumed = ctxt->input->consumed;
12834 if (oldctxt !=
NULL) {
12836 ctxt->attsDefault =
NULL;
12837 ctxt->attsSpecial =
NULL;
12838 oldctxt->nbErrors = ctxt->nbErrors;
12839 oldctxt->nbWarnings = ctxt->nbWarnings;
12840 oldctxt->validate = ctxt->validate;
12841 oldctxt->valid = ctxt->valid;
12842 oldctxt->node_seq.maximum = ctxt->node_seq.maximum;
12843 oldctxt->node_seq.length = ctxt->node_seq.length;
12844 oldctxt->node_seq.buffer = ctxt->node_seq.buffer;
12846 ctxt->node_seq.maximum = 0;
12847 ctxt->node_seq.length = 0;
12848 ctxt->node_seq.buffer =
NULL;
12850 newDoc->intSubset =
NULL;
12851 newDoc->extSubset =
NULL;
12852 xmlFreeDoc(newDoc);
12857#ifdef LIBXML_SAX1_ENABLED
12879xmlParseExternalEntity(xmlDocPtr doc, xmlSAXHandlerPtr sax,
void *user_data,
12906xmlParseBalancedChunkMemory(xmlDocPtr doc, xmlSAXHandlerPtr sax,
12907 void *user_data,
int depth,
const xmlChar *
string, xmlNodePtr *lst) {
12908 return xmlParseBalancedChunkMemoryRecover( doc, sax, user_data,
12909 depth,
string, lst, 0 );
12936 const xmlChar *
string,
void *user_data, xmlNodePtr *lst) {
12937 xmlParserCtxtPtr ctxt;
12938 xmlDocPtr newDoc =
NULL;
12939 xmlNodePtr newRoot;
12940 xmlSAXHandlerPtr oldsax =
NULL;
12947 if (((oldctxt->depth > 40) && ((oldctxt->options &
XML_PARSE_HUGE) == 0)) ||
12948 (oldctxt->depth > 100)) {
12950 "Maximum entity nesting depth exceeded");
12957 if (
string ==
NULL)
12962 ctxt->nbErrors = oldctxt->nbErrors;
12963 ctxt->nbWarnings = oldctxt->nbWarnings;
12964 if (user_data !=
NULL)
12965 ctxt->userData = user_data;
12967 ctxt->userData = ctxt;
12969 ctxt->dict = oldctxt->dict;
12970 ctxt->input_id = oldctxt->input_id;
12973 ctxt->str_xml_ns =
xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36);
12990 for (
i = 0;
i < oldctxt->nsdb->hashSize;
i++) {
12998 nsIndex = bucket->
index;
12999 ns = &oldctxt->nsTab[nsIndex * 2];
13000 extra = &oldctxt->nsdb->extra[nsIndex];
13014 oldsax = ctxt->sax;
13015 ctxt->sax = oldctxt->sax;
13017 ctxt->replaceEntities = oldctxt->replaceEntities;
13018 ctxt->options = oldctxt->options;
13020 ctxt->_private = oldctxt->_private;
13021 if (oldctxt->myDoc ==
NULL) {
13022 newDoc = xmlNewDoc(
BAD_CAST "1.0");
13023 if (newDoc ==
NULL) {
13027 newDoc->properties = XML_DOC_INTERNAL;
13028 newDoc->dict = ctxt->dict;
13030 ctxt->myDoc = newDoc;
13032 ctxt->myDoc = oldctxt->myDoc;
13033 content = ctxt->myDoc->children;
13034 last = ctxt->myDoc->last;
13037 if (newRoot ==
NULL) {
13041 ctxt->myDoc->children =
NULL;
13042 ctxt->myDoc->last =
NULL;
13043 xmlAddChild((xmlNodePtr) ctxt->myDoc, newRoot);
13044 nodePush(ctxt, ctxt->myDoc->children);
13046 ctxt->depth = oldctxt->depth;
13048 ctxt->validate = 0;
13049 ctxt->loadsubset = oldctxt->loadsubset;
13050 if ((oldctxt->validate) || (oldctxt->replaceEntities != 0)) {
13056 ctxt->dictNames = oldctxt->dictNames;
13057 ctxt->attsDefault = oldctxt->attsDefault;
13058 ctxt->attsSpecial = oldctxt->attsSpecial;
13061 if ((
RAW ==
'<') && (
NXT(1) ==
'/')) {
13063 }
else if (
RAW != 0) {
13066 if (ctxt->node != ctxt->myDoc->children) {
13070 if (!ctxt->wellFormed) {
13072 oldctxt->errNo = ctxt->errNo;
13073 oldctxt->wellFormed = 0;
13086 cur = ctxt->myDoc->children->children;
13089#ifdef LIBXML_VALID_ENABLED
13090 if ((oldctxt->validate) && (oldctxt->wellFormed) &&
13091 (oldctxt->myDoc) && (oldctxt->myDoc->intSubset) &&
13092 (
cur->type == XML_ELEMENT_NODE)) {
13093 oldctxt->valid &= xmlValidateElement(&oldctxt->vctxt,
13094 oldctxt->myDoc,
cur);
13100 ctxt->myDoc->children->children =
NULL;
13102 if (ctxt->myDoc !=
NULL) {
13103 xmlFreeNode(ctxt->myDoc->children);
13104 ctxt->myDoc->children =
content;
13105 ctxt->myDoc->last =
last;
13111 if (ctxt->input !=
NULL && oldctxt !=
NULL) {
13112 unsigned long consumed = ctxt->input->consumed;
13120 oldctxt->nbErrors = ctxt->nbErrors;
13121 oldctxt->nbWarnings = ctxt->nbWarnings;
13124 ctxt->sax = oldsax;
13126 ctxt->attsDefault =
NULL;
13127 ctxt->attsSpecial =
NULL;
13129 if (newDoc !=
NULL) {
13130 xmlFreeDoc(newDoc);
13157 int options, xmlNodePtr *lst) {
13158 xmlParserCtxtPtr ctxt;
13159 xmlDocPtr doc =
NULL;
13160 xmlNodePtr fake,
cur;
13170 switch (
node->type) {
13171 case XML_ELEMENT_NODE:
13172 case XML_ATTRIBUTE_NODE:
13173 case XML_TEXT_NODE:
13174 case XML_CDATA_SECTION_NODE:
13175 case XML_ENTITY_REF_NODE:
13177 case XML_COMMENT_NODE:
13178 case XML_DOCUMENT_NODE:
13179 case XML_HTML_DOCUMENT_NODE:
13185 while ((
node !=
NULL) && (
node->type != XML_ELEMENT_NODE) &&
13186 (
node->type != XML_DOCUMENT_NODE) &&
13187 (
node->type != XML_HTML_DOCUMENT_NODE))
13191 if (
node->type == XML_ELEMENT_NODE)
13194 doc = (xmlDocPtr)
node;
13202 if (doc->type == XML_DOCUMENT_NODE)
13204#ifdef LIBXML_HTML_ENABLED
13205 else if (doc->type == XML_HTML_DOCUMENT_NODE) {
13206 ctxt = htmlCreateMemoryParserCtxt((
char *)
data,
datalen);
13211 options |= HTML_PARSE_NOIMPLIED;
13225 if (doc->dict !=
NULL) {
13226 if (ctxt->dict !=
NULL)
13228 ctxt->dict = doc->dict;
13232 if (doc->encoding !=
NULL) {
13236 if (hdlr !=
NULL) {
13247 ctxt->input_id = 2;
13250 fake = xmlNewDocComment(
node->doc,
NULL);
13251 if (fake ==
NULL) {
13255 xmlAddChild(
node, fake);
13257 if (
node->type == XML_ELEMENT_NODE)
13260 if ((ctxt->html == 0) && (
node->type == XML_ELEMENT_NODE)) {
13265 while ((
cur !=
NULL) && (
cur->type == XML_ELEMENT_NODE)) {
13266 xmlNsPtr
ns =
cur->nsDef;
13280 if ((ctxt->validate) || (ctxt->replaceEntities != 0)) {
13287#ifdef LIBXML_HTML_ENABLED
13288 if (doc->type == XML_HTML_DOCUMENT_NODE)
13289 __htmlParseContent(ctxt);
13295 if ((
RAW ==
'<') && (
NXT(1) ==
'/')) {
13297 }
else if (
RAW != 0) {
13300 if ((ctxt->node !=
NULL) && (ctxt->node !=
node)) {
13302 ctxt->wellFormed = 0;
13305 if (!ctxt->wellFormed) {
13306 if (ctxt->errNo == 0)
13334 xmlUnlinkNode(fake);
13339 xmlFreeNodeList(*lst);
13343 if (doc->dict !=
NULL)
13350#ifdef LIBXML_SAX1_ENABLED
13377xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
13378 void *user_data,
int depth,
const xmlChar *
string, xmlNodePtr *lst,
13380 xmlParserCtxtPtr ctxt;
13382 xmlSAXHandlerPtr oldsax =
NULL;
13393 if (
string ==
NULL)
13397 if (ctxt ==
NULL)
return(-1);
13398 ctxt->userData = ctxt;
13400 oldsax = ctxt->sax;
13402 if (user_data !=
NULL)
13403 ctxt->userData = user_data;
13405 newDoc = xmlNewDoc(
BAD_CAST "1.0");
13406 if (newDoc ==
NULL) {
13410 newDoc->properties = XML_DOC_INTERNAL;
13411 if ((doc !=
NULL) && (doc->dict !=
NULL)) {
13413 ctxt->dict = doc->dict;
13417 ctxt->str_xml_ns =
xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36);
13418 ctxt->dictNames = 1;
13419 newDoc->dict = ctxt->dict;
13426 newDoc->intSubset = doc->intSubset;
13427 newDoc->extSubset = doc->extSubset;
13430 if (newRoot ==
NULL) {
13432 ctxt->sax = oldsax;
13434 newDoc->intSubset =
NULL;
13435 newDoc->extSubset =
NULL;
13436 xmlFreeDoc(newDoc);
13439 xmlAddChild((xmlNodePtr) newDoc, newRoot);
13443 ctxt->myDoc = newDoc;
13445 ctxt->myDoc = newDoc;
13447 xmlSearchNsByHref(doc, (xmlNodePtr)doc, XML_XML_NAMESPACE);
13448 newDoc->oldNs = doc->oldNs;
13451 ctxt->input_id = 2;
13452 ctxt->depth =
depth;
13457 ctxt->validate = 0;
13458 ctxt->loadsubset = 0;
13461 if ( doc !=
NULL ){
13463 doc->children =
NULL;
13470 if ((
RAW ==
'<') && (
NXT(1) ==
'/')) {
13472 }
else if (
RAW != 0) {
13475 if (ctxt->node != newDoc->children) {
13479 if (!ctxt->wellFormed) {
13480 if (ctxt->errNo == 0)
13488 if ((lst !=
NULL) && ((
ret == 0) || (recover == 1))) {
13495 cur = newDoc->children->children;
13498 xmlSetTreeDoc(
cur, doc);
13502 newDoc->children->children =
NULL;
13506 ctxt->sax = oldsax;
13508 newDoc->intSubset =
NULL;
13509 newDoc->extSubset =
NULL;
13511 newDoc->oldNs =
NULL;
13512 xmlFreeDoc(newDoc);
13536xmlSAXParseEntity(xmlSAXHandlerPtr sax,
const char *
filename) {
13538 xmlParserCtxtPtr ctxt;
13541 if (ctxt ==
NULL) {
13545 if (ctxt->sax !=
NULL)
13548 ctxt->userData =
NULL;
13553 if (ctxt->wellFormed)
13557 xmlFreeDoc(ctxt->myDoc);
13558 ctxt->myDoc =
NULL;
13581xmlParseEntity(
const char *
filename) {
13599static xmlParserCtxtPtr
13602 xmlParserCtxtPtr pctx) {
13603 xmlParserCtxtPtr ctxt;
13604 xmlParserInputPtr inputStream;
13609 if (ctxt ==
NULL) {
13613 if (pctx !=
NULL) {
13614 ctxt->options = pctx->options;
13615 ctxt->_private = pctx->_private;
13616 ctxt->input_id = pctx->input_id;
13627 if (inputStream ==
NULL) {
13640 if (inputStream ==
NULL) {
13696 xmlParserCtxtPtr ctxt;
13697 xmlParserInputPtr inputStream;
13701 if (ctxt ==
NULL) {
13708 ctxt->linenumbers = 1;
13711 if (inputStream ==
NULL) {
13741#ifdef LIBXML_SAX1_ENABLED
13764xmlSAXParseFileWithData(xmlSAXHandlerPtr sax,
const char *
filename,
13765 int recovery,
void *
data) {
13767 xmlParserCtxtPtr ctxt;
13772 if (ctxt ==
NULL) {
13776 if (ctxt->sax !=
NULL)
13782 ctxt->_private =
data;
13785 if (ctxt->directory ==
NULL)
13788 ctxt->recovery = recovery;
13792 if ((ctxt->wellFormed) || recovery) {
13794 if ((
ret !=
NULL) && (ctxt->input->buf !=
NULL)) {
13795 if (ctxt->input->buf->compressed > 0)
13796 ret->compression = 9;
13798 ret->compression = ctxt->input->buf->compressed;
13803 xmlFreeDoc(ctxt->myDoc);
13804 ctxt->myDoc =
NULL;
13831xmlSAXParseFile(xmlSAXHandlerPtr sax,
const char *
filename,
13833 return(xmlSAXParseFileWithData(sax,
filename,recovery,
NULL));
13851 return(xmlSAXParseDoc(
NULL,
cur, 1));
13868xmlParseFile(
const char *
filename) {
13887xmlRecoverFile(
const char *
filename) {
13905xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt,
const xmlChar*
buffer,
13908 xmlParserInputPtr
input;
13943xmlSAXUserParseFile(xmlSAXHandlerPtr sax,
void *user_data,
13946 xmlParserCtxtPtr ctxt;
13949 if (ctxt ==
NULL)
return -1;
13950 if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
13955 if (user_data !=
NULL)
13956 ctxt->userData = user_data;
13960 if (ctxt->wellFormed)
13963 if (ctxt->errNo != 0)
13970 if (ctxt->myDoc !=
NULL) {
13971 xmlFreeDoc(ctxt->myDoc);
13972 ctxt->myDoc =
NULL;
13997 xmlParserCtxtPtr ctxt;
13998 xmlParserInputPtr
input;
13999 xmlParserInputBufferPtr
buf;
14031#ifdef LIBXML_SAX1_ENABLED
14054xmlSAXParseMemoryWithData(xmlSAXHandlerPtr sax,
const char *
buffer,
14055 int size,
int recovery,
void *
data) {
14057 xmlParserCtxtPtr ctxt;
14064 if (ctxt->sax !=
NULL)
14070 ctxt->_private=
data;
14073 ctxt->recovery = recovery;
14077 if ((ctxt->wellFormed) || recovery)
ret = ctxt->myDoc;
14080 xmlFreeDoc(ctxt->myDoc);
14081 ctxt->myDoc =
NULL;
14107xmlSAXParseMemory(xmlSAXHandlerPtr sax,
const char *
buffer,
14108 int size,
int recovery) {
14109 return xmlSAXParseMemoryWithData(sax,
buffer,
size, recovery,
NULL);
14124xmlDocPtr xmlParseMemory(
const char *
buffer,
int size) {
14142xmlDocPtr xmlRecoverMemory(
const char *
buffer,
int size) {
14159int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax,
void *user_data,
14162 xmlParserCtxtPtr ctxt;
14167 if (ctxt ==
NULL)
return -1;
14168 if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
14173 if (user_data !=
NULL)
14174 ctxt->userData = user_data;
14178 if (ctxt->wellFormed)
14181 if (ctxt->errNo != 0)
14188 if (ctxt->myDoc !=
NULL) {
14189 xmlFreeDoc(ctxt->myDoc);
14190 ctxt->myDoc =
NULL;
14208 xmlParserCtxtPtr ctxt;
14209 xmlParserInputPtr
input;
14210 xmlParserInputBufferPtr
buf;
14240#ifdef LIBXML_SAX1_ENABLED
14258xmlSAXParseDoc(xmlSAXHandlerPtr sax,
const xmlChar *
cur,
int recovery) {
14260 xmlParserCtxtPtr ctxt;
14261 xmlSAXHandlerPtr oldsax =
NULL;
14269 oldsax = ctxt->sax;
14271 ctxt->userData =
NULL;
14276 if ((ctxt->wellFormed) || recovery)
ret = ctxt->myDoc;
14279 xmlFreeDoc(ctxt->myDoc);
14280 ctxt->myDoc =
NULL;
14283 ctxt->sax = oldsax;
14302 return(xmlSAXParseDoc(
NULL,
cur, 0));
14306#ifdef LIBXML_LEGACY_ENABLED
14314static xmlEntityReferenceFunc xmlEntityRefFunc =
NULL;
14325xmlAddEntityReference(xmlEntityPtr ent, xmlNodePtr firstNode,
14326 xmlNodePtr lastNode)
14328 if (xmlEntityRefFunc !=
NULL) {
14329 (*xmlEntityRefFunc) (ent, firstNode, lastNode);
14341xmlSetEntityReferenceFunc(xmlEntityReferenceFunc
func)
14343 xmlEntityRefFunc =
func;
14360#define DICT_FREE(str) \
14361 if ((str) && ((!dict) || \
14362 (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \
14363 xmlFree((char *)(str));
14374 xmlParserInputPtr
input;
14386 ctxt->input =
NULL;
14389 if (ctxt->spaceTab !=
NULL) {
14390 ctxt->spaceTab[0] = -1;
14391 ctxt->space = &ctxt->spaceTab[0];
14393 ctxt->space =
NULL;
14407 ctxt->version =
NULL;
14409 ctxt->encoding =
NULL;
14411 ctxt->directory =
NULL;
14413 ctxt->extSubURI =
NULL;
14415 ctxt->extSubSystem =
NULL;
14416 if (ctxt->myDoc !=
NULL)
14417 xmlFreeDoc(ctxt->myDoc);
14418 ctxt->myDoc =
NULL;
14420 ctxt->standalone = -1;
14421 ctxt->hasExternalSubset = 0;
14422 ctxt->hasPErefs = 0;
14424 ctxt->external = 0;
14428 ctxt->wellFormed = 1;
14429 ctxt->nsWellFormed = 1;
14430 ctxt->disableSAX = 0;
14433 ctxt->vctxt.userData = ctxt;
14437 ctxt->record_info = 0;
14438 ctxt->checkIndex = 0;
14439 ctxt->endCheckState = 0;
14440 ctxt->inSubset = 0;
14443 ctxt->catalogs =
NULL;
14444 ctxt->sizeentities = 0;
14445 ctxt->sizeentcopy = 0;
14448 if (ctxt->attsDefault !=
NULL) {
14450 ctxt->attsDefault =
NULL;
14452 if (ctxt->attsSpecial !=
NULL) {
14454 ctxt->attsSpecial =
NULL;
14457#ifdef LIBXML_CATALOG_ENABLED
14458 if (ctxt->catalogs !=
NULL)
14459 xmlCatalogFreeLocal(ctxt->catalogs);
14461 ctxt->nbErrors = 0;
14462 ctxt->nbWarnings = 0;
14483 xmlParserInputPtr inputStream;
14484 xmlParserInputBufferPtr
buf;
14493 if (ctxt ==
NULL) {
14501 ctxt->directory =
NULL;
14507 if (inputStream ==
NULL) {
14513 inputStream->filename =
NULL;
14515 inputStream->filename = (
char *)
14517 inputStream->buf =
buf;
14523 (ctxt->input->buf !=
NULL)) {
14524 size_t pos = ctxt->input->cur - ctxt->input->base;
14536 if (encoding !=
NULL) {
14540 if (hdlr !=
NULL) {
14544 "Unsupported encoding %s\n",
BAD_CAST encoding);
14569 ctxt->recovery = 1;
14573 ctxt->recovery = 0;
14579 ctxt->loadsubset = 0;
14586 ctxt->replaceEntities = 1;
14591 ctxt->replaceEntities = 0;
14593 ctxt->pedantic = 1;
14597 ctxt->pedantic = 0;
14599 ctxt->keepBlanks = 0;
14604 ctxt->keepBlanks = 1;
14606 ctxt->validate = 1;
14608 ctxt->vctxt.warning =
NULL;
14610 ctxt->vctxt.error =
NULL;
14614 ctxt->validate = 0;
14616 ctxt->sax->warning =
NULL;
14620 ctxt->sax->error =
NULL;
14621 ctxt->sax->fatalError =
NULL;
14624#ifdef LIBXML_SAX1_ENABLED
14626 ctxt->sax->startElementNs =
NULL;
14627 ctxt->sax->endElementNs =
NULL;
14628 ctxt->sax->initialized = 1;
14634 ctxt->dictNames = 0;
14638 ctxt->dictNames = 1;
14641 ctxt->sax->cdataBlock =
NULL;
14668 if (ctxt->dict !=
NULL)
14683 ctxt->linenumbers = 1;
14719 ctxt->maxAmpl = maxAmpl;
14735xmlDoRead(xmlParserCtxtPtr ctxt,
const char *URL,
const char *encoding,
14741 if (encoding !=
NULL) {
14754 if ((URL !=
NULL) && (ctxt->input !=
NULL) &&
14755 (ctxt->input->filename ==
NULL))
14758 if ((ctxt->wellFormed) || ctxt->recovery)
14762 if (ctxt->myDoc !=
NULL) {
14763 xmlFreeDoc(ctxt->myDoc);
14766 ctxt->myDoc =
NULL;
14788 xmlParserCtxtPtr ctxt;
14813 xmlParserCtxtPtr ctxt;
14837 xmlParserCtxtPtr ctxt;
14862 xmlParserCtxtPtr ctxt;
14863 xmlParserInputBufferPtr
input;
14864 xmlParserInputPtr
stream;
14875 if (ctxt ==
NULL) {
14904 void *ioctx,
const char *URL,
const char *encoding,
int options)
14906 xmlParserCtxtPtr ctxt;
14907 xmlParserInputBufferPtr
input;
14908 xmlParserInputPtr
stream;
14910 if (ioread ==
NULL)
14917 if (ioclose !=
NULL)
14922 if (ctxt ==
NULL) {
14951 const char *URL,
const char *encoding,
int options)
14953 xmlParserInputBufferPtr
input;
14954 xmlParserInputPtr
stream;
14993 const char *encoding,
int options)
14995 xmlParserInputPtr
stream;
15029 const char *URL,
const char *encoding,
int options)
15031 xmlParserInputBufferPtr
input;
15032 xmlParserInputPtr
stream;
15075 const char *URL,
const char *encoding,
int options)
15077 xmlParserInputBufferPtr
input;
15078 xmlParserInputPtr
stream;
15121 const char *encoding,
int options)
15123 xmlParserInputBufferPtr
input;
15124 xmlParserInputPtr
stream;
15126 if (ioread ==
NULL)
15137 if (ioclose !=
NULL)
XMLPUBFUN void xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
XMLPUBFUN void xmlSAX2IgnorableWhitespace(void *ctx, const xmlChar *ch, int len)
XMLPUBFUN xmlEntityPtr xmlSAX2GetEntity(void *ctx, const xmlChar *name)
static void normalize(float vec[3])
_In_ uint16_t _Out_ ULONG * atts
int xmlBufIsEmpty(const xmlBufPtr buf)
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input)
xmlChar * xmlBufDetach(xmlBufPtr buf)
size_t xmlBufUse(const xmlBufPtr buf)
int xmlBufUpdateInput(xmlBufPtr buf, xmlParserInputPtr input, size_t pos)
size_t xmlBufShrink(xmlBufPtr buf, size_t len)
static const WCHAR version[]
void CDECL terminate(void)
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP char *__cdecl strstr(const char *, const char *)
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
#define check(expected, result)
xmlCharEncodingHandlerPtr xmlFindCharEncodingHandler(const char *name)
GLint GLint GLsizei GLsizei GLsizei depth
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble GLdouble q
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLenum GLenum GLenum input
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
int const JOCTET unsigned int datalen
XMLPUBFUN xmlEntityPtr xmlGetPredefinedEntity(const xmlChar *name)
@ XML_EXTERNAL_GENERAL_PARSED_ENTITY
@ XML_INTERNAL_PREDEFINED_ENTITY
@ XML_EXTERNAL_GENERAL_UNPARSED_ENTITY
@ XML_INTERNAL_GENERAL_ENTITY
@ XML_INTERNAL_PARAMETER_ENTITY
@ XML_EXTERNAL_PARAMETER_ENTITY
#define memcpy(s1, s2, n)
#define memmove(s1, s2, n)
struct task_struct * current
static const ASMPROP_RES defaults[ASM_NAME_MAX_PARAMS]
#define cmp(status, error)
static UINT PSTR DWORD size
INTERNETFEATURELIST feature
#define XML_MAX_TEXT_LENGTH
XML_DEPRECATED XMLPUBFUN xmlParserInputPtr xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity)
#define XML_SUBSTITUTE_PEREF
#define XML_SUBSTITUTE_REF
#define XML_MAX_NAME_LENGTH
XMLPUBFUN int xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
#define IS_PUBIDCHAR_CH(c)
XMLPUBFUN int xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
XMLPUBFUN void xmlFreeInputStream(xmlParserInputPtr input)
#define XML_MAX_LOOKUP_LIMIT
XMLPUBFUN int xmlCopyChar(int len, xmlChar *out, int val)
#define XML_MAX_HUGE_LENGTH
XMLPUBFUN xmlParserInputPtr xmlNewInputStream(xmlParserCtxtPtr ctxt)
#define XML_ENT_EXPANDING
#define XML_ENT_CONTAINS_LT
#define XML_ENT_CHECKED_LT
static unsigned __int64 next
xmlHashedString xmlDictLookupHashed(xmlDictPtr dict, const xmlChar *name, int len)
unsigned xmlDictComputeHash(const xmlDict *dict, const xmlChar *string)
void xmlDictFree(xmlDictPtr dict)
int xmlDictOwns(xmlDictPtr dict, const xmlChar *str)
ATTRIBUTE_NO_SANITIZE_INTEGER unsigned xmlDictCombineHash(unsigned v1, unsigned v2)
size_t xmlDictSetLimit(xmlDictPtr dict, size_t limit)
int xmlDictReference(xmlDictPtr dict)
const xmlChar * xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
void * xmlGenericErrorContext
xmlReallocFunc xmlRealloc
xmlGenericErrorFunc xmlGenericError
int xmlParserDebugEntities
xmlSAXLocator xmlDefaultSAXLocator
xmlMallocFunc xmlMallocAtomic
void xmlHashFree(xmlHashTablePtr hash, xmlHashDeallocator dealloc)
void * xmlHashLookup2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2)
int xmlHashSize(xmlHashTablePtr hash)
int xmlHashRemoveEntry2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, xmlHashDeallocator dealloc)
void * xmlHashQLookup2(xmlHashTablePtr hash, const xmlChar *prefix, const xmlChar *name, const xmlChar *prefix2, const xmlChar *name2)
void xmlHashScanFull(xmlHashTablePtr hash, xmlHashScannerFull scan, void *data)
int xmlHashUpdateEntry2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, void *payload, xmlHashDeallocator dealloc)
void xmlHashDefaultDeallocator(void *entry, const xmlChar *key ATTRIBUTE_UNUSED)
int xmlHashAddEntry2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, void *payload)
xmlHashTablePtr xmlHashCreateDict(int size, xmlDictPtr dict)
@ XML_PARSER_PUBLIC_LITERAL
@ XML_PARSER_SYSTEM_LITERAL
@ XML_PARSER_ATTRIBUTE_VALUE
@ XML_PARSER_ENTITY_VALUE
@ XML_PARSER_CDATA_SECTION
XMLPUBFUN xmlParserInputPtr xmlLoadExternalEntity(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
XML_GLOBALS_PARSER XMLPUBFUN void xmlInitParser(void)
XMLPUBFUN const xmlParserNodeInfo * xmlParserFindNodeInfo(const xmlParserCtxtPtr ctxt, const xmlNodePtr node)
XMLPUBFUN void xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq)
XMLPUBFUN void xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt, const xmlParserNodeInfoPtr info)
XMLPUBFUN xmlParserCtxtPtr xmlNewSAXParserCtxt(const xmlSAXHandler *sax, void *userData)
#define XML_COMPLETE_ATTRS
XMLPUBFUN void xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
#define XML_DEFAULT_VERSION
XMLPUBFUN void xmlClearParserCtxt(xmlParserCtxtPtr ctxt)
xmlParserNodeInfo * xmlParserNodeInfoPtr
XMLPUBFUN xmlParserCtxtPtr xmlNewParserCtxt(void)
XMLPUBFUN xmlParserInputPtr xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc)
XML_HIDDEN void __xmlRaiseError(xmlStructuredErrorFunc schannel, xmlGenericErrorFunc channel, void *data, void *ctx, void *nod, int domain, int code, xmlErrorLevel level, const char *file, int line, const char *str1, const char *str2, const char *str3, int int1, int col, const char *msg,...) LIBXML_ATTR_FORMAT(16
XML_HIDDEN void xmlParserInputBufferPtr xmlParserInputBufferCreateString(const xmlChar *str)
XML_HIDDEN int xmlParserGrow(xmlParserCtxtPtr ctxt)
XML_HIDDEN void xmlDetectEncoding(xmlParserCtxtPtr ctxt)
XML_HIDDEN void xmlSetDeclaredEncoding(xmlParserCtxtPtr ctxt, xmlChar *encoding)
XML_HIDDEN void xmlParserErrors const char const xmlChar const xmlChar * str2
XML_HIDDEN void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra)
XML_HIDDEN void xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info)
XML_HIDDEN void __xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr, const char *msg, const xmlChar *str1, const xmlChar *str2) LIBXML_ATTR_FORMAT(3
XML_HIDDEN void xmlParserShrink(xmlParserCtxtPtr ctxt)
XML_HIDDEN void xmlParserErrors const char const xmlChar * str1
XML_HIDDEN void XML_HIDDEN void xmlHaltParser(xmlParserCtxtPtr ctxt)
static void xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, size_t len, size_t size)
#define CMP10(s, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
void xmlStopParser(xmlParserCtxtPtr ctxt)
xmlChar * xmlParseNmtoken(xmlParserCtxtPtr ctxt)
static const char *const xmlW3CPIs[]
xmlChar * xmlParseVersionNum(xmlParserCtxtPtr ctxt)
static int xmlParserNsPush(xmlParserCtxtPtr ctxt, const xmlHashedString *prefix, const xmlHashedString *uri, void *saxData, int defAttr)
int xmlParseDefaultDecl(xmlParserCtxtPtr ctxt, xmlChar **value)
int xmlHasFeature(xmlFeature feature)
static int xmlParserEntityCheck(xmlParserCtxtPtr ctxt, unsigned long extra)
static xmlChar * xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, int normalize)
static xmlChar * xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize)
xmlDocPtr xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size, const char *URL, const char *encoding, int options)
void xmlParseElement(xmlParserCtxtPtr ctxt)
xmlChar * xmlParseAttValue(xmlParserCtxtPtr ctxt)
xmlParserErrors xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, int options, xmlNodePtr *lst)
static void xmlAddDefAttrs(xmlParserCtxtPtr ctxt, const xmlChar *fullname, const xmlChar *fullattr, const xmlChar *value)
static xmlParserErrors xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, xmlSAXHandlerPtr sax, void *user_data, int depth, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *list)
static int xmlParserNsStartElement(xmlParserNsData *nsdb)
static int xmlParserNsPop(xmlParserCtxtPtr ctxt, int nr)
void xmlParserNsFree(xmlParserNsData *nsdb)
xmlChar * xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict)
xmlParserInputPtr inputPop(xmlParserCtxtPtr ctxt)
int xmlSkipBlankChars(xmlParserCtxtPtr ctxt)
int nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value)
static int xmlCtxtGrowAttrs(xmlParserCtxtPtr ctxt, int nr)
static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int blank_chars)
xmlEnumerationPtr xmlParseNotationType(xmlParserCtxtPtr ctxt)
xmlDocPtr xmlReadMemory(const char *buffer, int size, const char *URL, const char *encoding, int options)
static void xmlParseEndTag2(xmlParserCtxtPtr ctxt, const xmlStartTag *tag)
#define GROW_PARSE_ATT_VALUE_INTERNAL(ctxt, in, start, end)
xmlDocPtr xmlReadFd(int fd, const char *URL, const char *encoding, int options)
static xmlElementContentPtr xmlParseElementChildrenContentDeclPriv(xmlParserCtxtPtr ctxt, int inputchk, int depth)
static xmlChar * xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar **str)
static xmlChar * xmlAttrNormalizeSpace(const xmlChar *src, xmlChar *dst)
static xmlParserErrors xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, const xmlChar *string, void *user_data, xmlNodePtr *lst)
static void xmlParseCharDataInternal(xmlParserCtxtPtr ctxt, int partial)
static void xmlParseConditionalSections(xmlParserCtxtPtr ctxt)
static int spacePop(xmlParserCtxtPtr ctxt)
static const xmlChar * xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other)
void xmlParseTextDecl(xmlParserCtxtPtr ctxt)
int xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk, int size, const char *filename, const char *encoding)
#define CMP4(s, c1, c2, c3, c4)
int xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *lst)
void xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt)
static int xmlParseElementStart(xmlParserCtxtPtr ctxt)
xmlDocPtr xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
xmlDocPtr xmlReadDoc(const xmlChar *cur, const char *URL, const char *encoding, int options)
#define CMP7(s, c1, c2, c3, c4, c5, c6, c7)
int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
void xmlParseCharData(xmlParserCtxtPtr ctxt, ATTRIBUTE_UNUSED int cdata)
static void xmlParseElementEnd(xmlParserCtxtPtr ctxt)
unsigned int xmlParserMaxDepth
static void xmlParseInternalSubset(xmlParserCtxtPtr ctxt)
static int xmlParserNsGrow(xmlParserCtxtPtr ctxt)
xmlParserCtxtPtr xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID, const xmlChar *base)
xmlParserNsData * xmlParserNsCreate(void)
#define XML_PARSER_ALLOWED_EXPANSION
static void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int partial)
xmlChar * xmlParseEncName(xmlParserCtxtPtr ctxt)
static void xmlParserNsReset(xmlParserNsData *nsdb)
#define XML_PARSER_BIG_BUFFER_SIZE
xmlChar xmlPopInput(xmlParserCtxtPtr ctxt)
xmlDocPtr xmlCtxtReadIO(xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, const char *URL, const char *encoding, int options)
static xmlChar * xmlStringDecodeEntitiesInt(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int what, xmlChar end, xmlChar end2, xmlChar end3, int check)
int xmlParseEnumeratedType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree)
xmlChar * xmlParseVersionInfo(xmlParserCtxtPtr ctxt)
const xmlChar * xmlParseName(xmlParserCtxtPtr ctxt)
static int xmlIsNameStartChar(xmlParserCtxtPtr ctxt, int c)
static int xmlParserNsLookup(xmlParserCtxtPtr ctxt, const xmlHashedString *prefix, xmlParserNsBucket **bucketPtr)
static int xmlAttrHashInsert(xmlParserCtxtPtr ctxt, unsigned size, const xmlChar *name, const xmlChar *uri, unsigned hashValue, int aindex)
static const xmlChar * xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref, const xmlChar **URI, int *nbNsPtr)
#define XML_ENT_FIXED_COST
void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt)
#define growBuffer(buffer, n)
int xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt)
#define XML_PARSER_BUFFER_SIZE
xmlDocPtr xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename, const char *encoding, int options)
void xmlParseContent(xmlParserCtxtPtr ctxt)
#define CMP5(s, c1, c2, c3, c4, c5)
int xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input)
void xmlParseMisc(xmlParserCtxtPtr ctxt)
xmlElementContentPtr xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk)
#define CMP8(s, c1, c2, c3, c4, c5, c6, c7, c8)
xmlParserCtxtPtr xmlCreateURLParserCtxt(const char *filename, int options)
xmlDocPtr xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar *str, const char *URL, const char *encoding, int options)
static void xmlCleanSpecialAttr(xmlParserCtxtPtr ctxt)
int xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
static const xmlChar * xmlParserNsLookupUri(xmlParserCtxtPtr ctxt, const xmlHashedString *prefix)
static int xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options)
int xmlParserNsUpdateSax(xmlParserCtxtPtr ctxt, const xmlChar *prefix, void *saxData)
int xmlParseAttributeType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree)
xmlChar * xmlStringDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int what, xmlChar end, xmlChar end2, xmlChar end3)
xmlChar * xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig)
void xmlParsePI(xmlParserCtxtPtr ctxt)
#define CMP6(s, c1, c2, c3, c4, c5, c6)
static const xmlChar * xmlParseQNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *name, xmlChar const *prefix)
void xmlParseCDSect(xmlParserCtxtPtr ctxt)
static xmlHashedString xmlParseNCName(xmlParserCtxtPtr ctxt)
int xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlElementContentPtr *result)
static int xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str)
static const xmlChar * xmlParseQName(xmlParserCtxtPtr ctxt, const xmlChar **prefix)
static void xmlCleanSpecialAttrCallback(void *payload, void *data, const xmlChar *fullname, const xmlChar *fullattr, const xmlChar *unused ATTRIBUTE_UNUSED)
int xmlParseElementDecl(xmlParserCtxtPtr ctxt)
void xmlParseMarkupDecl(xmlParserCtxtPtr ctxt)
xmlChar * xmlParsePubidLiteral(xmlParserCtxtPtr ctxt)
xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer, int size)
static int nameNsPush(xmlParserCtxtPtr ctxt, const xmlChar *value, const xmlChar *prefix, const xmlChar *URI, int line, int nsNr)
void xmlParseEntityDecl(xmlParserCtxtPtr ctxt)
static void xmlSaturatedAdd(unsigned long *dst, unsigned long val)
xmlEntityPtr xmlParseEntityRef(xmlParserCtxtPtr ctxt)
#define CMP9(s, c1, c2, c3, c4, c5, c6, c7, c8, c9)
const char *const xmlParserVersion
static void xmlParseContentInternal(xmlParserCtxtPtr ctxt)
static void xmlDetectSAX2(xmlParserCtxtPtr ctxt)
#define COPY_BUF(b, i, v)
xmlDocPtr xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd, const char *URL, const char *encoding, int options)
void xmlParseReference(xmlParserCtxtPtr ctxt)
static int spacePush(xmlParserCtxtPtr ctxt, int val)
static void xmlErrAttributeDup(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *localname)
void xmlParsePEReference(xmlParserCtxtPtr ctxt)
static xmlDocPtr xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse)
void * xmlParserNsLookupSax(xmlParserCtxtPtr ctxt, const xmlChar *prefix)
static int xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity)
void xmlParseComment(xmlParserCtxtPtr ctxt)
xmlParserCtxtPtr xmlCreateDocParserCtxt(const xmlChar *str)
xmlEnumerationPtr xmlParseEnumerationType(xmlParserCtxtPtr ctxt)
static xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar **str)
static void xmlAddSpecialAttr(xmlParserCtxtPtr ctxt, const xmlChar *fullname, const xmlChar *fullattr, int type)
static const unsigned char test_char_data[256]
xmlChar * xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int what, xmlChar end, xmlChar end2, xmlChar end3)
xmlParserCtxtPtr xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data, xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
xmlElementContentPtr xmlParseElementChildrenContentDecl(xmlParserCtxtPtr ctxt, int inputchk)
void xmlCtxtSetMaxAmplification(xmlParserCtxtPtr ctxt, unsigned maxAmpl)
xmlDocPtr xmlReadFile(const char *filename, const char *encoding, int options)
static const xmlChar * xmlParseNameComplex(xmlParserCtxtPtr ctxt)
int xmlCheckLanguageID(const xmlChar *lang)
int xmlParseSDDecl(xmlParserCtxtPtr ctxt)
static xmlHashedString xmlParseNCNameComplex(xmlParserCtxtPtr ctxt)
static int xmlIsNameChar(xmlParserCtxtPtr ctxt, int c)
static xmlHashedString xmlParseAttribute2(xmlParserCtxtPtr ctxt, const xmlChar *pref, const xmlChar *elem, xmlHashedString *hprefix, xmlChar **value, int *len, int *alloc)
xmlNodePtr nodePop(xmlParserCtxtPtr ctxt)
int xmlParseDocument(xmlParserCtxtPtr ctxt)
xmlParserCtxtPtr xmlCreateFileParserCtxt(const char *filename)
void xmlParseNotationDecl(xmlParserCtxtPtr ctxt)
static void xmlSaturatedAddSizeT(unsigned long *dst, unsigned long val)
static xmlHashedString xmlParseQNameHashed(xmlParserCtxtPtr ctxt, xmlHashedString *prefix)
static const xmlChar * xmlAttrNormalizeSpace2(xmlParserCtxtPtr ctxt, xmlChar *src, int *len)
xmlChar * xmlParseSystemLiteral(xmlParserCtxtPtr ctxt)
void xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, const xmlChar *SystemID)
int namePush(xmlParserCtxtPtr ctxt, const xmlChar *value)
int xmlParseCharRef(xmlParserCtxtPtr ctxt)
xmlChar * xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix)
xmlDefAttrs * xmlDefAttrsPtr
void xmlCtxtReset(xmlParserCtxtPtr ctxt)
static xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str)
void xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt)
const xmlChar * xmlParseEncodingDecl(xmlParserCtxtPtr ctxt)
static xmlParserCtxtPtr xmlCreateEntityParserCtxtInternal(xmlSAXHandlerPtr sax, void *userData, const xmlChar *URL, const xmlChar *ID, const xmlChar *base, xmlParserCtxtPtr pctx)
const xmlChar * xmlParsePITarget(xmlParserCtxtPtr ctxt)
const xmlChar * namePop(xmlParserCtxtPtr ctxt)
void xmlParseXMLDecl(xmlParserCtxtPtr ctxt)
wchar_t const *const size_t const buffer_size
const struct _xmlNode * node
Character const *const prefix
XMLPUBFUN xmlChar * xmlBuildURI(const xmlChar *URI, const xmlChar *base)
XMLPUBFUN void xmlFreeURI(xmlURIPtr uri)
XMLPUBFUN xmlURIPtr xmlParseURI(const char *str)
XMLPUBFUN xmlChar * xmlCanonicPath(const xmlChar *path)
XMLPUBFUN void xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur)
XMLPUBFUN xmlElementContentPtr xmlNewDocElementContent(xmlDocPtr doc, const xmlChar *name, xmlElementContentType type)
XMLPUBFUN xmlEnumerationPtr xmlCreateEnumeration(const xmlChar *name)
XMLPUBFUN void xmlFreeEnumeration(xmlEnumerationPtr cur)
XMLPUBFUN int xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name)
static const WCHAR lang[]
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
XMLPUBFUN xmlParserInputBufferPtr xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc)
XMLPUBFUN xmlParserInputBufferPtr xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc)
XMLPUBFUN void xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
XMLPUBFUN xmlParserInputBufferPtr xmlAllocParserInputBuffer(xmlCharEncoding enc)
XMLPUBFUN char * xmlParserGetDirectory(const char *filename)
XMLPUBFUN xmlParserInputBufferPtr xmlParserInputBufferCreateStatic(const char *mem, int size, xmlCharEncoding enc)
XMLPUBFUN int xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len)
int(* xmlInputReadCallback)(void *context, char *buffer, int len)
int(* xmlInputCloseCallback)(void *context)
XMLPUBFUN xmlParserInputBufferPtr xmlParserInputBufferCreateIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
XMLPUBFUN int xmlParserInputBufferPush(xmlParserInputBufferPtr in, int len, const char *buf)
XMLPUBFUN int xmlCopyError(const xmlError *from, xmlErrorPtr to)
XMLPUBFUN void xmlResetError(xmlErrorPtr err)
void(*) typedef void(* xmlStructuredErrorFunc)(void *userData, const xmlError *error)
XMLPUBFUN void XMLPUBFUN void XMLPUBFUN void xmlParserValidityError(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
@ XML_ERR_ATTRIBUTE_NOT_FINISHED
@ XML_ERR_NOT_WELL_BALANCED
@ XML_ERR_ENTITY_NOT_FINISHED
@ XML_ERR_VERSION_MISMATCH
@ XML_ERR_ENTITYREF_SEMICOL_MISSING
@ XML_ERR_PEREF_IN_PROLOG
@ XML_ERR_LT_IN_ATTRIBUTE
@ XML_WAR_UNKNOWN_VERSION
@ XML_ERR_CDATA_NOT_FINISHED
@ XML_ERR_ENTITY_PE_INTERNAL
@ XML_ERR_ATTLIST_NOT_STARTED
@ XML_ERR_LITERAL_NOT_FINISHED
@ XML_ERR_XMLDECL_NOT_FINISHED
@ XML_ERR_ENTITY_BOUNDARY
@ XML_ERR_ELEMCONTENT_NOT_STARTED
@ XML_ERR_LTSLASH_REQUIRED
@ XML_ERR_MIXED_NOT_STARTED
@ XML_DTD_STANDALONE_DEFAULTED
@ XML_ERR_PEREF_IN_EPILOG
@ XML_NS_ERR_UNDEFINED_NAMESPACE
@ XML_ERR_DOCTYPE_NOT_FINISHED
@ XML_WAR_UNDECLARED_ENTITY
@ XML_ERR_CONDSEC_INVALID
@ XML_ERR_PI_NOT_FINISHED
@ XML_ERR_RESERVED_XML_NAME
@ XML_ERR_ATTRIBUTE_REDEFINED
@ XML_ERR_TAG_NOT_FINISHED
@ XML_ERR_HYPHEN_IN_COMMENT
@ XML_ERR_MISPLACED_CDATA_END
@ XML_NS_ERR_XML_NAMESPACE
@ XML_ERR_CONDSEC_INVALID_KEYWORD
@ XML_ERR_ENTITY_IS_PARAMETER
@ XML_ERR_TAG_NAME_MISMATCH
@ XML_NS_ERR_ATTRIBUTE_REDEFINED
@ XML_ERR_INVALID_CHARREF
@ XML_ERR_NMTOKEN_REQUIRED
@ XML_ERR_PEREF_IN_INT_SUBSET
@ XML_ERR_ENTITY_IS_EXTERNAL
@ XML_ERR_UNKNOWN_VERSION
@ XML_ERR_ELEMCONTENT_NOT_FINISHED
@ XML_ERR_PCDATA_REQUIRED
@ XML_ERR_NOTATION_NOT_STARTED
@ XML_ERR_STRING_NOT_CLOSED
@ XML_ERR_ATTRIBUTE_NOT_STARTED
@ XML_ERR_ENTITY_CHAR_ERROR
@ XML_ERR_UNDECLARED_ENTITY
@ XML_ERR_CONDSEC_NOT_FINISHED
@ XML_ERR_INVALID_DEC_CHARREF
@ XML_ERR_LITERAL_NOT_STARTED
@ XML_ERR_COMMENT_NOT_FINISHED
@ XML_ERR_ATTRIBUTE_WITHOUT_VALUE
@ XML_ERR_STRING_NOT_STARTED
@ XML_WAR_NS_URI_RELATIVE
@ XML_ERR_INVALID_HEX_CHARREF
@ XML_ERR_SEPARATOR_REQUIRED
@ XML_ERR_ENTITY_PROCESSING
@ XML_ERR_VERSION_MISSING
@ XML_ERR_EXT_SUBSET_NOT_FINISHED
@ XML_ERR_STANDALONE_VALUE
@ XML_ERR_ATTLIST_NOT_FINISHED
@ XML_ERR_XMLDECL_NOT_STARTED
@ XML_ERR_PEREF_SEMICOL_MISSING
@ XML_ERR_NOTATION_NOT_FINISHED
@ XML_ERR_UNPARSED_ENTITY
@ XML_ERR_UNSUPPORTED_ENCODING
@ XML_ERR_ENTITY_NOT_STARTED
XMLPUBFUN void XMLPUBFUN void XMLPUBFUN void XMLPUBFUN void xmlParserValidityWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
XMLPUBFUN xmlChar * xmlStrndup(const xmlChar *cur, int len)
XMLPUBFUN int XMLPUBFUN int XMLPUBFUN int xmlGetUTF8Char(const unsigned char *utf, int *len)
XMLPUBFUN int xmlStrlen(const xmlChar *str)
XMLPUBFUN int xmlStrcmp(const xmlChar *str1, const xmlChar *str2)
XMLPUBFUN xmlChar * xmlCharStrdup(const char *cur)
XMLPUBFUN int xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len)
XMLPUBFUN int xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
XMLPUBFUN const xmlChar * xmlStrchr(const xmlChar *str, xmlChar val)
XMLPUBFUN xmlChar * xmlStrdup(const xmlChar *cur)
#define LIBXML_ATTR_FORMAT(fmt, args)
#define LIBXML_VERSION_EXTRA
#define LIBXML_VERSION_STRING