20#ifdef LIBXML_READER_ENABLED
30#ifdef LIBXML_SCHEMAS_ENABLED
35#ifdef LIBXML_XINCLUDE_ENABLED
38#ifdef LIBXML_PATTERN_ENABLED
44#define MAX_ERR_MSG_SIZE 64000
46#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
48#define MAX_FREE_NODES 1
50#define MAX_FREE_NODES 100
61 #define VA_COPY(dest, src) va_copy(dest, src)
64 #define VA_COPY(dest,src) __va_copy(dest, src)
66 #ifndef VA_LIST_IS_ARRAY
67 #define VA_COPY(dest,src) (dest) = (src)
70 #define VA_COPY(dest,src) memcpy((char *)(dest),(char *)(src),sizeof(va_list))
85 xmlGenericError(xmlGenericErrorContext, \
86 "Unimplemented block at %s:%d\n", \
90#define DUMP_READER xmlTextReaderDebug(reader);
103#define XML_TEXTREADER_INPUT 1
104#define XML_TEXTREADER_CTXT 2
107 XML_TEXTREADER_NONE = -1,
108 XML_TEXTREADER_START= 0,
109 XML_TEXTREADER_ELEMENT= 1,
110 XML_TEXTREADER_END= 2,
111 XML_TEXTREADER_EMPTY= 3,
112 XML_TEXTREADER_BACKTRACK= 4,
113 XML_TEXTREADER_DONE= 5,
114 XML_TEXTREADER_ERROR= 6
118 XML_TEXTREADER_NOT_VALIDATE = 0,
119 XML_TEXTREADER_VALIDATE_DTD = 1,
120 XML_TEXTREADER_VALIDATE_RNG = 2,
121 XML_TEXTREADER_VALIDATE_XSD = 4
122} xmlTextReaderValidate;
124struct _xmlTextReader {
129 xmlTextReaderState
state;
156 xmlTextReaderErrorFunc errorFunc;
159#ifdef LIBXML_SCHEMAS_ENABLED
161 xmlRelaxNGPtr rngSchemas;
162 xmlRelaxNGValidCtxtPtr rngValidCtxt;
167 xmlSchemaPtr xsdSchemas;
168 xmlSchemaValidCtxtPtr xsdValidCtxt;
171 xmlSchemaSAXPlugPtr xsdPlug;
173#ifdef LIBXML_XINCLUDE_ENABLED
177 xmlXIncludeCtxtPtr xincctxt;
180#ifdef LIBXML_PATTERN_ENABLED
183 xmlPatternPtr *patternTab;
191#define NODE_IS_EMPTY 0x1
192#define NODE_IS_PRESERVED 0x2
193#define NODE_IS_SPRESERVED 0x4
200#define CONSTSTR(str) xmlDictLookup(reader->dict, (str), -1)
201#define CONSTQSTR(p, str) xmlDictQLookup(reader->dict, (p), (str))
203static int xmlTextReaderReadTree(xmlTextReaderPtr
reader);
204static int xmlTextReaderNextTree(xmlTextReaderPtr
reader);
218#define DICT_FREE(str) \
219 if ((str) && ((!dict) || \
220 (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \
221 xmlFree((char *)(str));
238 dict =
reader->ctxt->dict;
247 xmlTextReaderFreeNodeList(
reader,
cur->children);
251 (
reader->ctxt->freeAttrsNr < MAX_FREE_NODES)) {
254 reader->ctxt->freeAttrsNr++;
294 dict =
reader->ctxt->dict;
311 (
cur->children->parent ==
cur)) {
329 xmlTextReaderFreePropList(
reader,
cur->properties);
352 (
reader->ctxt->freeElemsNr < MAX_FREE_NODES)) {
355 reader->ctxt->freeElemsNr++;
386 dict =
reader->ctxt->dict;
404 if (
cur->children->parent ==
cur)
405 xmlTextReaderFreeNodeList(
reader,
cur->children);
416 xmlTextReaderFreePropList(
reader,
cur->properties);
440 (
reader->ctxt->freeElemsNr < MAX_FREE_NODES)) {
443 reader->ctxt->freeElemsNr++;
472 extSubset =
cur->extSubset;
473 intSubset =
cur->intSubset;
474 if (intSubset == extSubset)
476 if (extSubset !=
NULL) {
481 if (intSubset !=
NULL) {
487 if (
cur->children !=
NULL) xmlTextReaderFreeNodeList(
reader,
cur->children);
506xmlTextReaderDebug(xmlTextReaderPtr
reader) {
523#ifdef LIBXML_DEBUG_ENABLED
524 xmlDebugDumpString(
stderr,
544 if (
reader->entMax <= 0) {
547 sizeof(
reader->entTab[0]));
558 sizeof(
reader->entTab[0]));
578xmlTextReaderEntPop(xmlTextReaderPtr
reader)
608#ifdef DEBUG_CALLBACKS
619 reader->state = XML_TEXTREADER_ELEMENT;
634#ifdef DEBUG_CALLBACKS
658xmlTextReaderStartElementNs(
void *
ctx,
671#ifdef DEBUG_CALLBACKS
672 printf(
"xmlTextReaderStartElementNs(%s)\n", localname);
676 namespaces, nb_attributes, nb_defaulted,
684 reader->state = XML_TEXTREADER_ELEMENT;
697xmlTextReaderEndElementNs(
void *
ctx,
705#ifdef DEBUG_CALLBACKS
706 printf(
"xmlTextReaderEndElementNs(%s)\n", localname);
723xmlTextReaderCharacters(
void *
ctx,
const xmlChar *ch,
int len)
728#ifdef DEBUG_CALLBACKS
729 printf(
"xmlTextReaderCharacters()\n");
745xmlTextReaderCDataBlock(
void *
ctx,
const xmlChar *ch,
int len)
750#ifdef DEBUG_CALLBACKS
751 printf(
"xmlTextReaderCDataBlock()\n");
768xmlTextReaderPushData(xmlTextReaderPtr
reader) {
771 xmlTextReaderState oldstate;
778 reader->state = XML_TEXTREADER_NONE;
782 while (
reader->state == XML_TEXTREADER_NONE) {
787 if (
reader->mode != XML_TEXTREADER_MODE_EOF) {
792 reader->mode = XML_TEXTREADER_MODE_EOF;
795 }
else if (
val < 0) {
796 reader->mode = XML_TEXTREADER_MODE_EOF;
798 if ((oldstate != XML_TEXTREADER_START) ||
801 }
else if (
val == 0) {
803 reader->mode = XML_TEXTREADER_MODE_EOF;
820 reader->ctxt->wellFormed = 0;
821 if (
reader->ctxt->wellFormed == 0)
830 reader->ctxt->wellFormed = 0;
838 if (
reader->mode == XML_TEXTREADER_MODE_INTERACTIVE) {
840 if ((
reader->cur >= 4096) &&
854 else if (
reader->mode == XML_TEXTREADER_MODE_EOF) {
855 if (
reader->state != XML_TEXTREADER_DONE) {
861 reader->state = XML_TEXTREADER_DONE;
863 if (
reader->ctxt->wellFormed)
864 reader->ctxt->wellFormed = 0;
871 if (
reader->ctxt->wellFormed == 0) {
872 reader->mode = XML_TEXTREADER_MODE_EOF;
879#ifdef LIBXML_REGEXP_ENABLED
890#ifdef LIBXML_VALID_ENABLED
891 if ((
reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
894 reader->ctxt->valid &= xmlValidatePushElement(&
reader->ctxt->vctxt,
903 reader->ctxt->valid &= xmlValidatePushElement(&
reader->ctxt->vctxt,
910#ifdef LIBXML_SCHEMAS_ENABLED
911 if ((
reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
916 ret = xmlRelaxNGValidatePushElement(
reader->rngValidCtxt,
927 ret = xmlRelaxNGValidateFullElement(
reader->rngValidCtxt,
948xmlTextReaderValidateCData(xmlTextReaderPtr
reader,
950#ifdef LIBXML_VALID_ENABLED
951 if ((
reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
953 reader->ctxt->valid &= xmlValidatePushCData(&
reader->ctxt->vctxt,
957#ifdef LIBXML_SCHEMAS_ENABLED
958 if ((
reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
977xmlTextReaderValidatePop(xmlTextReaderPtr
reader) {
980#ifdef LIBXML_VALID_ENABLED
981 if ((
reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
984 reader->ctxt->valid &= xmlValidatePopElement(&
reader->ctxt->vctxt,
993 reader->ctxt->valid &= xmlValidatePopElement(&
reader->ctxt->vctxt,
1000#ifdef LIBXML_SCHEMAS_ENABLED
1001 if ((
reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
1010 ret = xmlRelaxNGValidatePopElement(
reader->rngValidCtxt,
1014 reader->rngValidErrors++;
1028xmlTextReaderValidateEntity(xmlTextReaderPtr
reader) {
1036 (
node->children->children !=
NULL)) {
1044 if (
node == oldnode)
1048#ifdef LIBXML_REGEXP_ENABLED
1051 xmlTextReaderValidatePush(
reader);
1054 xmlTextReaderValidateCData(
reader,
node->content,
1066 xmlTextReaderValidatePop(
reader);
1077 if (
reader->entNr == 0) {
1078 while ((tmp =
node->last) !=
NULL) {
1079 if ((tmp->
extra & NODE_IS_PRESERVED) == 0) {
1081 xmlTextReaderFreeNode(
reader, tmp);
1087 xmlTextReaderValidatePop(
reader);
1093 if (
node == oldnode)
1138xmlTextReaderDoExpand(xmlTextReaderPtr
reader) {
1146 if (xmlTextReaderGetSuccessor(
reader->node) !=
NULL)
1150 if (
reader->mode == XML_TEXTREADER_MODE_EOF)
1154 reader->mode = XML_TEXTREADER_MODE_ERROR;
1157 }
while(
reader->mode != XML_TEXTREADER_MODE_EOF);
1186 switch (
node->type) {
1194 tmp = xmlTextReaderCollectSiblings(
node->children);
1220xmlTextReaderRead(xmlTextReaderPtr
reader) {
1221 int val, olddepth = 0;
1222 xmlTextReaderState oldstate = XML_TEXTREADER_START;
1230 return(xmlTextReaderReadTree(
reader));
1238 if (
reader->mode == XML_TEXTREADER_MODE_INITIAL) {
1239 reader->mode = XML_TEXTREADER_MODE_INTERACTIVE;
1246 reader->mode = XML_TEXTREADER_MODE_ERROR;
1247 reader->state = XML_TEXTREADER_ERROR;
1251 ((
reader->mode != XML_TEXTREADER_MODE_EOF) &&
1252 (
reader->state != XML_TEXTREADER_DONE)));
1258 reader->mode = XML_TEXTREADER_MODE_ERROR;
1259 reader->state = XML_TEXTREADER_ERROR;
1262 reader->state = XML_TEXTREADER_ELEMENT;
1269 reader->state = XML_TEXTREADER_ELEMENT;
1275 oldstate =
reader->state;
1276 olddepth =
reader->ctxt->nodeNr;
1281 if (
reader->mode == XML_TEXTREADER_MODE_EOF)
1293 (
reader->ctxt->nodeNr == olddepth) &&
1294 ((oldstate == XML_TEXTREADER_BACKTRACK) ||
1309 reader->mode = XML_TEXTREADER_MODE_ERROR;
1310 reader->state = XML_TEXTREADER_ERROR;
1316 if (oldstate != XML_TEXTREADER_BACKTRACK) {
1323 reader->state = XML_TEXTREADER_ELEMENT;
1328 if ((oldstate == XML_TEXTREADER_ELEMENT) &&
1331 ((
reader->node->extra & NODE_IS_EMPTY) == 0)
1333 && (
reader->in_xinclude <= 0)
1336 reader->state = XML_TEXTREADER_END;
1339#ifdef LIBXML_REGEXP_ENABLED
1340 if ((
reader->validate) &&
1342 xmlTextReaderValidatePop(
reader);
1344 if ((
reader->preserves > 0) &&
1345 (
reader->node->extra & NODE_IS_SPRESERVED))
1348 reader->state = XML_TEXTREADER_ELEMENT;
1353 if ((
reader->preserves == 0) &&
1355 (
reader->in_xinclude == 0) &&
1361 if ((tmp->
extra & NODE_IS_PRESERVED) == 0) {
1365 xmlTextReaderFreeNode(
reader, tmp);
1371 if ((oldstate == XML_TEXTREADER_ELEMENT) &&
1374 ((
reader->node->extra & NODE_IS_EMPTY) == 0)) {;
1375 reader->state = XML_TEXTREADER_END;
1378#ifdef LIBXML_REGEXP_ENABLED
1380 xmlTextReaderValidatePop(
reader);
1382 if ((
reader->preserves > 0) &&
1383 (
reader->node->extra & NODE_IS_SPRESERVED))
1389 if (
reader->mode != XML_TEXTREADER_MODE_EOF) {
1390 val = xmlParseChunk(
reader->ctxt,
"", 0, 1);
1391 reader->state = XML_TEXTREADER_DONE;
1401 if ((oldnode !=
NULL) && (
reader->preserves == 0) &&
1403 (
reader->in_xinclude == 0) &&
1407 ((oldnode->
extra & NODE_IS_PRESERVED) == 0)) {
1409 xmlTextReaderFreeNode(
reader, oldnode);
1414 if ((
reader->preserves == 0) &&
1416 (
reader->in_xinclude == 0) &&
1420 ((
reader->node->last->extra & NODE_IS_PRESERVED) == 0)) {
1423 xmlTextReaderFreeNode(
reader, tmp);
1426 reader->state = XML_TEXTREADER_BACKTRACK;
1442#ifdef LIBXML_XINCLUDE_ENABLED
1446 if ((
reader->xinclude) && (
reader->in_xinclude == 0) &&
1453 reader->xincctxt = xmlXIncludeNewContext(
reader->ctxt->myDoc);
1454 xmlXIncludeSetFlags(
reader->xincctxt,
1462 xmlXIncludeProcessNode(
reader->xincctxt,
reader->node);
1481 (
reader->node->children->children !=
NULL)) {
1485#ifdef LIBXML_REGEXP_ENABLED
1489 xmlTextReaderValidateEntity(
reader);
1499#ifdef LIBXML_REGEXP_ENABLED
1500 if ((
reader->validate != XML_TEXTREADER_NOT_VALIDATE) && (
reader->node !=
NULL)) {
1504 ((
reader->state != XML_TEXTREADER_END) &&
1505 (
reader->state != XML_TEXTREADER_BACKTRACK))) {
1506 xmlTextReaderValidatePush(
reader);
1509 xmlTextReaderValidateCData(
reader,
node->content,
1514#ifdef LIBXML_PATTERN_ENABLED
1515 if ((
reader->patternNr > 0) && (
reader->state != XML_TEXTREADER_END) &&
1516 (
reader->state != XML_TEXTREADER_BACKTRACK)) {
1519 if (xmlPatternMatch(
reader->patternTab[
i],
reader->node) == 1) {
1520 xmlTextReaderPreserve(
reader);
1526#ifdef LIBXML_SCHEMAS_ENABLED
1527 if ((
reader->validate == XML_TEXTREADER_VALIDATE_XSD) &&
1528 (
reader->xsdValidErrors == 0) &&
1530 reader->xsdValidErrors = !xmlSchemaIsValid(
reader->xsdValidCtxt);
1535 reader->state = XML_TEXTREADER_DONE;
1548xmlTextReaderReadState(xmlTextReaderPtr
reader) {
1565xmlTextReaderExpand(xmlTextReaderPtr
reader) {
1572 if (xmlTextReaderDoExpand(
reader) < 0)
1588xmlTextReaderNext(xmlTextReaderPtr
reader) {
1595 return(xmlTextReaderNextTree(
reader));
1598 return(xmlTextReaderRead(
reader));
1599 if (
reader->state == XML_TEXTREADER_END ||
reader->state == XML_TEXTREADER_BACKTRACK)
1600 return(xmlTextReaderRead(
reader));
1601 if (
cur->extra & NODE_IS_EMPTY)
1602 return(xmlTextReaderRead(
reader));
1608 return(xmlTextReaderRead(
reader));
1611#ifdef LIBXML_WRITER_ENABLED
1638 for (cur_node =
reader->node->children; cur_node !=
NULL;
1639 cur_node = cur_node->
next) {
1645 if (xmlNodeDump(buff2, doc,
node, 0, 0) == -1) {
1655 resbuf =
buff->content;
1663#ifdef LIBXML_WRITER_ENABLED
1695 if (xmlNodeDump(
buff, doc,
node, 0, 0) == -1) {
1701 resbuf =
buff->content;
1721xmlTextReaderReadString(xmlTextReaderPtr
reader)
1735 if (xmlTextReaderDoExpand(
reader) != -1) {
1736 return xmlTextReaderCollectSiblings(
node->children);
1764xmlTextReaderReadBase64(xmlTextReaderPtr
reader,
1770 if (
reader->ctxt->wellFormed != 1)
1794xmlTextReaderReadBinHex(xmlTextReaderPtr
reader,
1800 if (
reader->ctxt->wellFormed != 1)
1816xmlTextReaderNextTree(xmlTextReaderPtr
reader)
1821 if (
reader->state == XML_TEXTREADER_END)
1826 reader->state = XML_TEXTREADER_END;
1831 reader->state = XML_TEXTREADER_START;
1835 if (
reader->state != XML_TEXTREADER_BACKTRACK) {
1838 if (
reader->node->next != 0) {
1841 reader->state = XML_TEXTREADER_START;
1847 reader->state = XML_TEXTREADER_BACKTRACK;
1849 xmlTextReaderRead(
reader);
1852 if (
reader->node->next != 0) {
1854 reader->state = XML_TEXTREADER_START;
1858 if (
reader->node->parent != 0) {
1860 reader->state = XML_TEXTREADER_END;
1866 reader->state = XML_TEXTREADER_BACKTRACK;
1868 xmlTextReaderNextTree(
reader);
1871 reader->state = XML_TEXTREADER_END;
1887xmlTextReaderReadTree(xmlTextReaderPtr
reader) {
1888 if (
reader->state == XML_TEXTREADER_END)
1894 reader->state = XML_TEXTREADER_END;
1899 reader->state = XML_TEXTREADER_START;
1903 if ((
reader->state != XML_TEXTREADER_BACKTRACK) &&
1910 reader->state = XML_TEXTREADER_START;
1915 reader->state = XML_TEXTREADER_BACKTRACK;
1922 reader->state = XML_TEXTREADER_START;
1929 reader->state = XML_TEXTREADER_END;
1935 reader->state = XML_TEXTREADER_BACKTRACK;
1939 reader->state = XML_TEXTREADER_END;
1961xmlTextReaderNextSibling(xmlTextReaderPtr
reader) {
1969 if (
reader->state == XML_TEXTREADER_END)
1973 return(xmlTextReaderNextTree(
reader));
1977 reader->state = XML_TEXTREADER_START;
2000 xmlTextReaderPtr
ret;
2007 "xmlNewTextReader : malloc failed\n");
2020 "xmlNewTextReader : malloc failed\n");
2031 "xmlNewTextReader : malloc failed\n");
2035 ret->startElement =
ret->sax->startElement;
2036 ret->sax->startElement = xmlTextReaderStartElement;
2037 ret->endElement =
ret->sax->endElement;
2038 ret->sax->endElement = xmlTextReaderEndElement;
2039#ifdef LIBXML_SAX1_ENABLED
2042 ret->startElementNs =
ret->sax->startElementNs;
2043 ret->sax->startElementNs = xmlTextReaderStartElementNs;
2044 ret->endElementNs =
ret->sax->endElementNs;
2045 ret->sax->endElementNs = xmlTextReaderEndElementNs;
2046#ifdef LIBXML_SAX1_ENABLED
2052 ret->characters =
ret->sax->characters;
2053 ret->sax->characters = xmlTextReaderCharacters;
2054 ret->sax->ignorableWhitespace = xmlTextReaderCharacters;
2055 ret->cdataBlock =
ret->sax->cdataBlock;
2056 ret->sax->cdataBlock = xmlTextReaderCDataBlock;
2058 ret->mode = XML_TEXTREADER_MODE_INITIAL;
2065 ret->ctxt = xmlCreatePushParserCtxt(
ret->sax,
NULL,
2071 ret->ctxt = xmlCreatePushParserCtxt(
ret->sax,
NULL,
NULL, 0, URI);
2078 "xmlNewTextReader : malloc failed\n");
2085 ret->ctxt->_private =
ret;
2086 ret->ctxt->linenumbers = 1;
2087 ret->ctxt->dictNames = 1;
2088 ret->allocs = XML_TEXTREADER_CTXT;
2092 ret->ctxt->docdict = 1;
2093 ret->dict =
ret->ctxt->dict;
2094#ifdef LIBXML_XINCLUDE_ENABLED
2097#ifdef LIBXML_PATTERN_ENABLED
2098 ret->patternMax = 0;
2113xmlNewTextReaderFilename(
const char *URI) {
2115 xmlTextReaderPtr
ret;
2121 ret = xmlNewTextReader(
input, URI);
2126 ret->allocs |= XML_TEXTREADER_INPUT;
2127 if (
ret->ctxt->directory ==
NULL)
2143xmlFreeTextReader(xmlTextReaderPtr
reader) {
2146#ifdef LIBXML_SCHEMAS_ENABLED
2148 xmlRelaxNGFree(
reader->rngSchemas);
2152 if (!
reader->rngPreserveCtxt)
2153 xmlRelaxNGFreeValidCtxt(
reader->rngValidCtxt);
2157 xmlSchemaSAXUnplug(
reader->xsdPlug);
2161 if (!
reader->xsdPreserveCtxt)
2162 xmlSchemaFreeValidCtxt(
reader->xsdValidCtxt);
2166 xmlSchemaFree(
reader->xsdSchemas);
2170#ifdef LIBXML_XINCLUDE_ENABLED
2172 xmlXIncludeFreeContext(
reader->xincctxt);
2174#ifdef LIBXML_PATTERN_ENABLED
2179 xmlFreePattern(
reader->patternTab[
i]);
2184 if (
reader->mode != XML_TEXTREADER_MODE_CLOSED)
2185 xmlTextReaderClose(
reader);
2189 if (
reader->allocs & XML_TEXTREADER_CTXT)
2218xmlTextReaderClose(xmlTextReaderPtr
reader) {
2223 reader->mode = XML_TEXTREADER_MODE_CLOSED;
2229#ifdef LIBXML_VALID_ENABLED
2230 if ((
reader->ctxt->vctxt.vstateTab !=
NULL) &&
2231 (
reader->ctxt->vctxt.vstateMax > 0)){
2232#ifdef LIBXML_REGEXP_ENABLED
2233 while (
reader->ctxt->vctxt.vstateNr > 0)
2238 reader->ctxt->vctxt.vstateMax = 0;
2243 if (
reader->preserve == 0)
2250 reader->allocs -= XML_TEXTREADER_INPUT;
2267xmlTextReaderGetAttributeNo(xmlTextReaderPtr
reader,
int no) {
2334 if (localname ==
NULL) {
2388xmlTextReaderGetAttributeNs(xmlTextReaderPtr
reader,
const xmlChar *localName,
2389 const xmlChar *namespaceURI) {
2438xmlTextReaderGetRemainder(xmlTextReaderPtr
reader) {
2448 reader->mode = XML_TEXTREADER_MODE_EOF;
2452 if (
reader->preserve == 0)
2457 if (
reader->allocs & XML_TEXTREADER_INPUT) {
2460 reader->allocs -= XML_TEXTREADER_INPUT;
2512xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr
reader,
int no) {
2577 if (localname ==
NULL) {
2593 prop =
reader->node->properties;
2594 while (prop !=
NULL) {
2624 prop =
reader->node->properties;
2625 while (prop !=
NULL) {
2639 if (localname !=
NULL)
2646 if (localname !=
NULL)
2665xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr
reader,
2696 prop =
node->properties;
2697 while (prop !=
NULL) {
2724xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr
reader) {
2753xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr
reader) {
2761 return(xmlTextReaderMoveToFirstAttribute(
reader));
2792xmlTextReaderMoveToElement(xmlTextReaderPtr
reader) {
2817xmlTextReaderReadAttributeValue(xmlTextReaderPtr
reader) {
2836 (
reader->faketext->content !=
2860xmlTextReaderConstEncoding(xmlTextReaderPtr
reader) {
2867 doc =
reader->ctxt->myDoc;
2892xmlTextReaderAttributeCount(xmlTextReaderPtr
reader) {
2910 if ((
reader->state == XML_TEXTREADER_END) ||
2911 (
reader->state == XML_TEXTREADER_BACKTRACK))
2938xmlTextReaderNodeType(xmlTextReaderPtr
reader) {
2944 return(XML_READER_TYPE_NONE);
2949 switch (
node->type) {
2951 if ((
reader->state == XML_TEXTREADER_END) ||
2952 (
reader->state == XML_TEXTREADER_BACKTRACK))
2953 return(XML_READER_TYPE_END_ELEMENT);
2954 return(XML_READER_TYPE_ELEMENT);
2957 return(XML_READER_TYPE_ATTRIBUTE);
2961 return(XML_READER_TYPE_SIGNIFICANT_WHITESPACE);
2963 return(XML_READER_TYPE_WHITESPACE);
2965 return(XML_READER_TYPE_TEXT);
2968 return(XML_READER_TYPE_CDATA);
2970 return(XML_READER_TYPE_ENTITY_REFERENCE);
2972 return(XML_READER_TYPE_ENTITY);
2974 return(XML_READER_TYPE_PROCESSING_INSTRUCTION);
2976 return(XML_READER_TYPE_COMMENT);
2979 return(XML_READER_TYPE_DOCUMENT);
2981 return(XML_READER_TYPE_DOCUMENT_FRAGMENT);
2983 return(XML_READER_TYPE_NOTATION);
2986 return(XML_READER_TYPE_DOCUMENT_TYPE);
2993 return(XML_READER_TYPE_NONE);
3007xmlTextReaderIsEmptyElement(xmlTextReaderPtr
reader) {
3016 if (
reader->state == XML_TEXTREADER_END)
3020#ifdef LIBXML_XINCLUDE_ENABLED
3021 if (
reader->in_xinclude > 0)
3024 return((
reader->node->extra & NODE_IS_EMPTY) != 0);
3037xmlTextReaderLocalName(xmlTextReaderPtr
reader) {
3054 return(xmlTextReaderName(
reader));
3068xmlTextReaderConstLocalName(xmlTextReaderPtr
reader) {
3079 return(CONSTSTR(
BAD_CAST "xmlns"));
3085 return(xmlTextReaderConstName(
reader));
3099xmlTextReaderName(xmlTextReaderPtr
reader) {
3109 switch (
node->type) {
3172xmlTextReaderConstName(xmlTextReaderPtr
reader) {
3181 switch (
node->type) {
3187 return(CONSTQSTR(
node->ns->prefix,
node->name));
3189 return(CONSTSTR(
BAD_CAST "#text"));
3191 return(CONSTSTR(
BAD_CAST "#cdata-section"));
3194 return(CONSTSTR(
node->name));
3196 return(CONSTSTR(
node->name));
3198 return(CONSTSTR(
BAD_CAST "#comment"));
3201 return(CONSTSTR(
BAD_CAST "#document"));
3203 return(CONSTSTR(
BAD_CAST "#document-fragment"));
3205 return(CONSTSTR(
node->name));
3208 return(CONSTSTR(
node->name));
3213 return(CONSTSTR(
BAD_CAST "xmlns"));
3237xmlTextReaderPrefix(xmlTextReaderPtr
reader) {
3269xmlTextReaderConstPrefix(xmlTextReaderPtr
reader) {
3281 return(CONSTSTR(
BAD_CAST "xmlns"));
3287 return(CONSTSTR(
node->ns->prefix));
3301xmlTextReaderNamespaceUri(xmlTextReaderPtr
reader) {
3329xmlTextReaderConstNamespaceUri(xmlTextReaderPtr
reader) {
3338 return(CONSTSTR(
BAD_CAST "http://www.w3.org/2000/xmlns/"));
3343 return(CONSTSTR(
node->ns->href));
3357xmlTextReaderBaseUri(xmlTextReaderPtr
reader) {
3373xmlTextReaderConstBaseUri(xmlTextReaderPtr
reader) {
3382 ret = CONSTSTR(tmp);
3396xmlTextReaderDepth(xmlTextReaderPtr
reader) {
3405 return(
reader->depth + 1);
3406 return(
reader->depth + 2);
3420xmlTextReaderHasAttributes(xmlTextReaderPtr
reader) {
3447xmlTextReaderHasValue(xmlTextReaderPtr
reader) {
3458 switch (
node->type) {
3482xmlTextReaderValue(xmlTextReaderPtr
reader) {
3493 switch (
node->type) {
3501 (
attr->parent->doc,
attr->children, 1));
3528xmlTextReaderConstValue(xmlTextReaderPtr
reader) {
3539 switch (
node->type) {
3549 return(
attr->children->content);
3555 "xmlTextReaderSetup : malloc failed\n");
3580 return(
node->content);
3597xmlTextReaderIsDefault(xmlTextReaderPtr
reader) {
3612xmlTextReaderQuoteChar(xmlTextReaderPtr
reader) {
3629xmlTextReaderXmlLang(xmlTextReaderPtr
reader) {
3646xmlTextReaderConstXmlLang(xmlTextReaderPtr
reader) {
3657 ret = CONSTSTR(tmp);
3677 return(CONSTSTR(
str));
3693xmlTextReaderNormalization(xmlTextReaderPtr
reader) {
3718xmlTextReaderSetParserProp(xmlTextReaderPtr
reader,
int prop,
int value) {
3719 xmlParserProperties
p = (xmlParserProperties) prop;
3727 case XML_PARSER_LOADDTD:
3730 if (
reader->mode != XML_TEXTREADER_MODE_INITIAL)
3738 case XML_PARSER_DEFAULTATTRS:
3746 case XML_PARSER_VALIDATE:
3750 reader->validate = XML_TEXTREADER_VALIDATE_DTD;
3752 ctxt->
options &= ~XML_PARSE_DTDVALID;
3756 case XML_PARSER_SUBST_ENTITIES:
3761 ctxt->
options &= ~XML_PARSE_NOENT;
3779xmlTextReaderGetParserProp(xmlTextReaderPtr
reader,
int prop) {
3780 xmlParserProperties
p = (xmlParserProperties) prop;
3788 case XML_PARSER_LOADDTD:
3792 case XML_PARSER_DEFAULTATTRS:
3796 case XML_PARSER_VALIDATE:
3797 return(
reader->validate);
3798 case XML_PARSER_SUBST_ENTITIES:
3814xmlTextReaderGetParserLineNumber(xmlTextReaderPtr
reader)
3820 return (
reader->ctxt->input->line);
3832xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr
reader)
3838 return (
reader->ctxt->input->col);
3852xmlTextReaderCurrentNode(xmlTextReaderPtr
reader) {
3872xmlTextReaderPreserve(xmlTextReaderPtr
reader) {
3886 cur->extra |= NODE_IS_PRESERVED;
3887 cur->extra |= NODE_IS_SPRESERVED;
3894 parent->extra |= NODE_IS_PRESERVED;
3900#ifdef LIBXML_PATTERN_ENABLED
3922 comp = xmlPatterncompile(
pattern,
reader->dict, 0, namespaces);
3926 if (
reader->patternMax <= 0) {
3929 sizeof(
reader->patternTab[0]));
3940 sizeof(
reader->patternTab[0]));
3946 reader->patternTab = tmp;
3949 return(
reader->patternNr++);
3966xmlTextReaderCurrentDoc(xmlTextReaderPtr
reader) {
3975 return(
reader->ctxt->myDoc);
3978#ifdef LIBXML_SCHEMAS_ENABLED
3994xmlTextReaderValidityErrorRelay(
void *
ctx,
const char *
msg, ...)
3996 xmlTextReaderPtr
reader = (xmlTextReaderPtr)
ctx;
4003 str = xmlTextReaderBuildMessage(
msg,
ap);
4004 if (!
reader->errorFunc) {
4005 xmlTextReaderValidityError(
ctx,
"%s",
str);
4017xmlTextReaderValidityWarningRelay(
void *
ctx,
const char *
msg, ...)
4019 xmlTextReaderPtr
reader = (xmlTextReaderPtr)
ctx;
4026 str = xmlTextReaderBuildMessage(
msg,
ap);
4027 if (!
reader->errorFunc) {
4028 xmlTextReaderValidityWarning(
ctx,
"%s",
str);
4045 xmlTextReaderPtr
reader = (xmlTextReaderPtr) userData;
4047 if (
reader->sErrorFunc) {
4068xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr
reader, xmlRelaxNGPtr
schema) {
4073 xmlRelaxNGFree(
reader->rngSchemas);
4077 if (!
reader->rngPreserveCtxt)
4078 xmlRelaxNGFreeValidCtxt(
reader->rngValidCtxt);
4081 reader->rngPreserveCtxt = 0;
4084 if (
reader->mode != XML_TEXTREADER_MODE_INITIAL)
4087 xmlRelaxNGFree(
reader->rngSchemas);
4091 if (!
reader->rngPreserveCtxt)
4092 xmlRelaxNGFreeValidCtxt(
reader->rngValidCtxt);
4095 reader->rngPreserveCtxt = 0;
4100 xmlRelaxNGSetValidErrors(
reader->rngValidCtxt,
4101 xmlTextReaderValidityErrorRelay,
4102 xmlTextReaderValidityWarningRelay,
4106 xmlRelaxNGSetValidStructuredErrors(
reader->rngValidCtxt,
4107 xmlTextReaderValidityStructuredRelay,
4110 reader->rngValidErrors = 0;
4112 reader->validate = XML_TEXTREADER_VALIDATE_RNG;
4128xmlTextReaderLocator(
void *
ctx,
const char **
file,
unsigned long *
line) {
4161 *
file = (
const char *) doc->
URL;
4185xmlTextReaderSetSchema(xmlTextReaderPtr
reader, xmlSchemaPtr
schema) {
4190 xmlSchemaSAXUnplug(
reader->xsdPlug);
4194 if (!
reader->xsdPreserveCtxt)
4195 xmlSchemaFreeValidCtxt(
reader->xsdValidCtxt);
4198 reader->xsdPreserveCtxt = 0;
4200 xmlSchemaFree(
reader->xsdSchemas);
4205 if (
reader->mode != XML_TEXTREADER_MODE_INITIAL)
4208 xmlSchemaSAXUnplug(
reader->xsdPlug);
4212 if (!
reader->xsdPreserveCtxt)
4213 xmlSchemaFreeValidCtxt(
reader->xsdValidCtxt);
4216 reader->xsdPreserveCtxt = 0;
4218 xmlSchemaFree(
reader->xsdSchemas);
4223 xmlSchemaFree(
reader->xsdSchemas);
4227 reader->xsdPlug = xmlSchemaSAXPlug(
reader->xsdValidCtxt,
4229 &(
reader->ctxt->userData));
4231 xmlSchemaFree(
reader->xsdSchemas);
4233 xmlSchemaFreeValidCtxt(
reader->xsdValidCtxt);
4237 xmlSchemaValidateSetLocator(
reader->xsdValidCtxt,
4238 xmlTextReaderLocator,
4242 xmlSchemaSetValidErrors(
reader->xsdValidCtxt,
4243 xmlTextReaderValidityErrorRelay,
4244 xmlTextReaderValidityWarningRelay,
4248 xmlSchemaSetValidStructuredErrors(
reader->xsdValidCtxt,
4249 xmlTextReaderValidityStructuredRelay,
4252 reader->xsdValidErrors = 0;
4253 reader->validate = XML_TEXTREADER_VALIDATE_XSD;
4272xmlTextReaderRelaxNGValidateInternal(xmlTextReaderPtr
reader,
4274 xmlRelaxNGValidCtxtPtr ctxt,
4280 if ((rng !=
NULL) && (ctxt !=
NULL))
4283 if (((rng !=
NULL) || (ctxt !=
NULL)) &&
4284 ((
reader->mode != XML_TEXTREADER_MODE_INITIAL) ||
4290 if ( !
reader->rngPreserveCtxt)
4291 xmlRelaxNGFreeValidCtxt(
reader->rngValidCtxt);
4294 reader->rngPreserveCtxt = 0;
4296 xmlRelaxNGFree(
reader->rngSchemas);
4300 if ((rng ==
NULL) && (ctxt ==
NULL)) {
4307 xmlRelaxNGParserCtxtPtr pctxt;
4310 pctxt = xmlRelaxNGNewParserCtxt(rng);
4312 xmlRelaxNGSetParserErrors(pctxt,
4313 xmlTextReaderValidityErrorRelay,
4314 xmlTextReaderValidityWarningRelay,
4318 xmlRelaxNGSetValidStructuredErrors(
reader->rngValidCtxt,
4319 xmlTextReaderValidityStructuredRelay,
4322 reader->rngSchemas = xmlRelaxNGParse(pctxt);
4323 xmlRelaxNGFreeParserCtxt(pctxt);
4326 reader->rngValidCtxt = xmlRelaxNGNewValidCtxt(
reader->rngSchemas);
4328 xmlRelaxNGFree(
reader->rngSchemas);
4334 reader->rngValidCtxt = ctxt;
4335 reader->rngPreserveCtxt = 1;
4344 xmlRelaxNGSetValidErrors(
reader->rngValidCtxt,
4345 xmlTextReaderValidityErrorRelay,
4346 xmlTextReaderValidityWarningRelay,
4350 xmlRelaxNGSetValidStructuredErrors(
reader->rngValidCtxt,
4351 xmlTextReaderValidityStructuredRelay,
4354 reader->rngValidErrors = 0;
4356 reader->validate = XML_TEXTREADER_VALIDATE_RNG;
4375xmlTextReaderSchemaValidateInternal(xmlTextReaderPtr
reader,
4377 xmlSchemaValidCtxtPtr ctxt,
4383 if ((xsd !=
NULL) && (ctxt !=
NULL))
4386 if (((xsd !=
NULL) || (ctxt !=
NULL)) &&
4387 ((
reader->mode != XML_TEXTREADER_MODE_INITIAL) ||
4393 xmlSchemaSAXUnplug(
reader->xsdPlug);
4397 if (!
reader->xsdPreserveCtxt)
4398 xmlSchemaFreeValidCtxt(
reader->xsdValidCtxt);
4401 reader->xsdPreserveCtxt = 0;
4403 xmlSchemaFree(
reader->xsdSchemas);
4407 if ((xsd ==
NULL) && (ctxt ==
NULL)) {
4413 xmlSchemaParserCtxtPtr pctxt;
4415 pctxt = xmlSchemaNewParserCtxt(xsd);
4417 xmlSchemaSetParserErrors(pctxt,
4418 xmlTextReaderValidityErrorRelay,
4419 xmlTextReaderValidityWarningRelay,
4422 reader->xsdSchemas = xmlSchemaParse(pctxt);
4423 xmlSchemaFreeParserCtxt(pctxt);
4426 reader->xsdValidCtxt = xmlSchemaNewValidCtxt(
reader->xsdSchemas);
4428 xmlSchemaFree(
reader->xsdSchemas);
4432 reader->xsdPlug = xmlSchemaSAXPlug(
reader->xsdValidCtxt,
4434 &(
reader->ctxt->userData));
4436 xmlSchemaFree(
reader->xsdSchemas);
4438 xmlSchemaFreeValidCtxt(
reader->xsdValidCtxt);
4444 reader->xsdValidCtxt = ctxt;
4445 reader->xsdPreserveCtxt = 1;
4446 reader->xsdPlug = xmlSchemaSAXPlug(
reader->xsdValidCtxt,
4448 &(
reader->ctxt->userData));
4451 reader->xsdPreserveCtxt = 0;
4455 xmlSchemaValidateSetLocator(
reader->xsdValidCtxt,
4456 xmlTextReaderLocator,
4465 xmlSchemaSetValidErrors(
reader->xsdValidCtxt,
4466 xmlTextReaderValidityErrorRelay,
4467 xmlTextReaderValidityWarningRelay,
4471 xmlSchemaSetValidStructuredErrors(
reader->xsdValidCtxt,
4472 xmlTextReaderValidityStructuredRelay,
4475 reader->xsdValidErrors = 0;
4476 reader->validate = XML_TEXTREADER_VALIDATE_XSD;
4494xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr
reader,
4495 xmlSchemaValidCtxtPtr ctxt,
4514xmlTextReaderSchemaValidate(xmlTextReaderPtr
reader,
const char *xsd)
4516 return(xmlTextReaderSchemaValidateInternal(
reader, xsd,
NULL, 0));
4533xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr
reader,
4534 xmlRelaxNGValidCtxtPtr ctxt,
4553xmlTextReaderRelaxNGValidate(xmlTextReaderPtr
reader,
const char *rng)
4555 return(xmlTextReaderRelaxNGValidateInternal(
reader, rng,
NULL, 0));
4572xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr
reader) {
4599xmlTextReaderConstXmlVersion(xmlTextReaderPtr
reader) {
4606 doc =
reader->ctxt->myDoc;
4613 return(CONSTSTR(doc->
version));
4627xmlTextReaderStandalone(xmlTextReaderPtr
reader) {
4634 doc =
reader->ctxt->myDoc;
4649xmlTextReaderBuildMessage(
const char *
msg,
va_list ap) {
4666 if ((chars <
size) || (
size == MAX_ERR_MSG_SIZE))
4668 if (chars < MAX_ERR_MSG_SIZE)
4671 size = MAX_ERR_MSG_SIZE;
4693xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr
locator) {
4730xmlTextReaderLocatorBaseURI(xmlTextReaderLocatorPtr
locator) {
4763 xmlTextReaderPtr
reader = (xmlTextReaderPtr)
ctx->_private;
4768 (xmlTextReaderLocatorPtr)
ctx);
4778 xmlTextReaderPtr
reader = (xmlTextReaderPtr)
ctx->_private;
4786xmlTextReaderError(
void *ctxt,
const char *
msg, ...)
4791 xmlTextReaderGenericError(ctxt,
4793 xmlTextReaderBuildMessage(
msg,
ap));
4799xmlTextReaderWarning(
void *ctxt,
const char *
msg, ...)
4804 xmlTextReaderGenericError(ctxt,
4806 xmlTextReaderBuildMessage(
msg,
ap));
4811xmlTextReaderValidityError(
void *ctxt,
const char *
msg, ...)
4817 if ((
len > 1) && (
msg[
len - 2] !=
':')) {
4823 xmlTextReaderGenericError(ctxt,
4825 xmlTextReaderBuildMessage(
msg,
ap));
4831xmlTextReaderValidityWarning(
void *ctxt,
const char *
msg, ...)
4837 if ((
len != 0) && (
msg[
len - 1] !=
':')) {
4843 xmlTextReaderGenericError(ctxt,
4845 xmlTextReaderBuildMessage(
msg,
ap));
4861xmlTextReaderSetErrorHandler(xmlTextReaderPtr
reader,
4862 xmlTextReaderErrorFunc
f,
void *
arg)
4865 reader->ctxt->sax->error = xmlTextReaderError;
4867 reader->ctxt->vctxt.error = xmlTextReaderValidityError;
4868 reader->ctxt->sax->warning = xmlTextReaderWarning;
4869 reader->ctxt->vctxt.warning = xmlTextReaderValidityWarning;
4873#ifdef LIBXML_SCHEMAS_ENABLED
4874 if (
reader->rngValidCtxt) {
4875 xmlRelaxNGSetValidErrors(
reader->rngValidCtxt,
4876 xmlTextReaderValidityErrorRelay,
4877 xmlTextReaderValidityWarningRelay,
4879 xmlRelaxNGSetValidStructuredErrors(
reader->rngValidCtxt,
NULL,
4882 if (
reader->xsdValidCtxt) {
4883 xmlSchemaSetValidErrors(
reader->xsdValidCtxt,
4884 xmlTextReaderValidityErrorRelay,
4885 xmlTextReaderValidityWarningRelay,
4887 xmlSchemaSetValidStructuredErrors(
reader->xsdValidCtxt,
NULL,
4900#ifdef LIBXML_SCHEMAS_ENABLED
4901 if (
reader->rngValidCtxt) {
4904 xmlRelaxNGSetValidStructuredErrors(
reader->rngValidCtxt,
NULL,
4907 if (
reader->xsdValidCtxt) {
4910 xmlSchemaSetValidStructuredErrors(
reader->xsdValidCtxt,
NULL,
4928xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr
reader,
4933 reader->ctxt->sax->serror = xmlTextReaderStructuredError;
4934 reader->ctxt->vctxt.error = xmlTextReaderValidityError;
4935 reader->ctxt->sax->warning = xmlTextReaderWarning;
4936 reader->ctxt->vctxt.warning = xmlTextReaderValidityWarning;
4940#ifdef LIBXML_SCHEMAS_ENABLED
4941 if (
reader->rngValidCtxt) {
4944 xmlRelaxNGSetValidStructuredErrors(
reader->rngValidCtxt,
4945 xmlTextReaderValidityStructuredRelay,
4948 if (
reader->xsdValidCtxt) {
4951 xmlSchemaSetValidStructuredErrors(
reader->xsdValidCtxt,
4952 xmlTextReaderValidityStructuredRelay,
4966#ifdef LIBXML_SCHEMAS_ENABLED
4967 if (
reader->rngValidCtxt) {
4970 xmlRelaxNGSetValidStructuredErrors(
reader->rngValidCtxt,
NULL,
4973 if (
reader->xsdValidCtxt) {
4976 xmlSchemaSetValidStructuredErrors(
reader->xsdValidCtxt,
NULL,
4992xmlTextReaderIsValid(xmlTextReaderPtr
reader)
4996#ifdef LIBXML_SCHEMAS_ENABLED
4997 if (
reader->validate == XML_TEXTREADER_VALIDATE_RNG)
4998 return (
reader->rngValidErrors == 0);
4999 if (
reader->validate == XML_TEXTREADER_VALIDATE_XSD)
5000 return (
reader->xsdValidErrors == 0);
5003 return (
reader->ctxt->valid);
5016xmlTextReaderGetErrorHandler(xmlTextReaderPtr
reader,
5017 xmlTextReaderErrorFunc *
f,
void **
arg)
5044xmlTextReaderSetup(xmlTextReaderPtr
reader,
5063 reader->validate = XML_TEXTREADER_NOT_VALIDATE;
5065 (
reader->allocs & XML_TEXTREADER_INPUT)) {
5068 reader->allocs -= XML_TEXTREADER_INPUT;
5072 reader->allocs |= XML_TEXTREADER_INPUT;
5078 "xmlTextReaderSetup : malloc failed\n");
5088 "xmlTextReaderSetup : malloc failed\n");
5093 reader->sax->startElement = xmlTextReaderStartElement;
5095 reader->sax->endElement = xmlTextReaderEndElement;
5096#ifdef LIBXML_SAX1_ENABLED
5100 reader->sax->startElementNs = xmlTextReaderStartElementNs;
5102 reader->sax->endElementNs = xmlTextReaderEndElementNs;
5103#ifdef LIBXML_SAX1_ENABLED
5110 reader->sax->characters = xmlTextReaderCharacters;
5111 reader->sax->ignorableWhitespace = xmlTextReaderCharacters;
5113 reader->sax->cdataBlock = xmlTextReaderCDataBlock;
5115 reader->mode = XML_TEXTREADER_MODE_INITIAL;
5144 if (inputStream ==
NULL) {
5162 "xmlTextReaderSetup : malloc failed\n");
5181 reader->ctxt->linenumbers = 1;
5182 reader->ctxt->dictNames = 1;
5186 reader->ctxt->docdict = 1;
5189#ifdef LIBXML_XINCLUDE_ENABLED
5191 xmlXIncludeFreeContext(
reader->xincctxt);
5202#ifdef LIBXML_PATTERN_ENABLED
5207 while (
reader->patternNr > 0) {
5217 reader->validate = XML_TEXTREADER_VALIDATE_DTD;
5229 reader->ctxt->input->filename = (
char *)
5251xmlTextReaderByteConsumed(xmlTextReaderPtr
reader) {
5269 xmlTextReaderPtr
ret;
5277 "xmlNewTextReader : malloc failed\n");
5283 ret->mode = XML_TEXTREADER_MODE_INITIAL;
5288 ret->allocs = XML_TEXTREADER_CTXT;
5290 ret->state = XML_TEXTREADER_START;
5317 return (xmlReaderForMemory
5358xmlReaderForMemory(
const char *
buffer,
int size,
const char *URL,
5374 reader->allocs |= XML_TEXTREADER_INPUT;
5411 reader->allocs |= XML_TEXTREADER_INPUT;
5432 void *ioctx,
const char *URL,
const char *
encoding,
5444 if (ioclose !=
NULL)
5453 reader->allocs |= XML_TEXTREADER_INPUT;
5485 reader->mode = XML_TEXTREADER_MODE_INITIAL;
5490 reader->allocs = XML_TEXTREADER_CTXT;
5492 reader->state = XML_TEXTREADER_START;
5529 return (xmlReaderNewMemory(
reader, (
const char *)
cur,
len,
5616xmlReaderNewFd(xmlTextReaderPtr
reader,
int fd,
5665 if (ioclose !=
NULL)
5693xmlBase64Decode(
const unsigned char *
in,
unsigned long *inlen,
5694 unsigned char *to,
unsigned long *tolen)
5696 unsigned long incur;
5698 unsigned long inblk;
5700 unsigned long outcur;
5702 unsigned long inmax;
5704 unsigned long outmax;
5708 unsigned char intmp[4], outtmp[4];
5735 if ((
cur >=
'A') && (
cur <=
'Z'))
5737 else if ((
cur >=
'a') && (
cur <=
'z'))
5739 else if ((
cur >=
'0') && (
cur <=
'9'))
5741 else if (
cur ==
'+')
5743 else if (
cur ==
'/')
5745 else if (
cur ==
'.')
5747 else if (
cur ==
'=')
5763 if ((nbintmp == 1) || (nbintmp == 2))
5770 intmp[nbintmp++] =
cur;
5777 outtmp[0] = (intmp[0] << 2) | ((intmp[1] & 0x30) >> 4);
5779 ((intmp[1] & 0x0F) << 4) | ((intmp[2] & 0x3C) >> 2);
5780 outtmp[2] = ((intmp[2] & 0x03) << 6) | (intmp[3] & 0x3F);
5781 if (outcur + 3 >= outmax) {
5786 for (
i = 0;
i < nbouttmp;
i++)
5787 to[outcur++] = outtmp[
i];
5810 char *
input =
" VW4 gcGV0 \n aXQgdGVzdCAuCg== ";
5820 unsigned long outlen = 100;
5824 unsigned long cons, tmp, tmp2, prod;
5829 ret = xmlBase64Decode(
input, &inlen, output, &outlen);
5832 printf(
"ret: %d, inlen: %ld , outlen: %ld, output: '%s'\n",
ret, inlen,
5841 while (
cons < inlen) {
5843 tmp2 = inlen -
cons;
5846 ret = xmlBase64Decode(&
input[
cons], &tmp2, &output2[prod], &tmp);
5851 output2[outlen] = 0;
5852 printf(
"ret: %d, cons: %ld , prod: %ld, output: '%s'\n",
ret,
cons,
5860 while (
cons < inlen) {
5862 tmp2 = inlen -
cons;
5867 ret = xmlBase64Decode(&
input[
cons], &tmp2, &output3[prod], &tmp);
5872 output3[outlen] = 0;
5873 printf(
"ret: %d, cons: %ld , prod: %ld, output: '%s'\n",
ret,
cons,
#define VA_COPY(Dest, Start)
XMLPUBFUN int XMLCALL xmlSAXVersion(xmlSAXHandler *hdlr, int version)
ACPI_SIZE strlen(const char *String)
pair cons(caddr_t car, pair cdr)
_In_ uint16_t _Out_ ULONG * atts
void xmlBufEmpty(xmlBufPtr buf)
int xmlBufGetAllocationScheme(xmlBufPtr buf)
void xmlBufFree(xmlBufPtr buf)
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input)
xmlBufPtr xmlBufCreateSize(size_t size)
int xmlBufSetAllocationScheme(xmlBufPtr buf, xmlBufferAllocationScheme scheme)
static const WCHAR indent[]
static WCHAR no[MAX_STRING_RESOURCE_LEN]
BOOL next_node(stream_t *stream, strbuf_t *buf)
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler(const char *name)
static unsigned char buff[32768]
static FRESULT validate(void *obj)
GLint GLint GLsizei GLsizei GLsizei depth
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei const GLvoid GLenum preserve
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
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
int __xmlRegisterCallbacks
XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewInputStream(xmlParserCtxtPtr ctxt)
XMLPUBFUN int XMLCALL inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
XMLPUBFUN int XMLCALL xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
static unsigned __int64 next
XMLPUBFUN const xmlChar *XMLCALL xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreate(void)
XMLPUBFUN void XMLCALL xmlDictFree(xmlDictPtr dict)
XMLPUBVAR xmlMallocFunc xmlMalloc
XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue
XMLPUBVAR xmlFreeFunc xmlFree
XMLPUBVAR void * xmlGenericErrorContext
XMLPUBVAR xmlReallocFunc xmlRealloc
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
void(* startElementNsSAX2Func)(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes)
void(* cdataBlockSAXFunc)(void *ctx, const xmlChar *value, int len)
XMLPUBFUN void XMLCALL xmlStopParser(xmlParserCtxtPtr ctxt)
#define XML_COMPLETE_ATTRS
XMLPUBFUN void XMLCALL xmlCtxtReset(xmlParserCtxtPtr ctxt)
void(* charactersSAXFunc)(void *ctx, const xmlChar *ch, int len)
XMLPUBFUN int XMLCALL xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
XMLPUBFUN void XMLCALL xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
void(* endElementSAXFunc)(void *ctx, const xmlChar *name)
void(* startElementSAXFunc)(void *ctx, const xmlChar *name, const xmlChar **atts)
XMLPUBFUN long XMLCALL xmlByteConsumed(xmlParserCtxtPtr ctxt)
void(* endElementNsSAX2Func)(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)
XMLPUBFUN void XMLCALL xmlBufferFree(xmlBufferPtr buf)
XMLPUBFUN void XMLCALL xmlFreeDtd(xmlDtdPtr cur)
XMLPUBFUN void XMLCALL xmlFreeDoc(xmlDocPtr cur)
XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace)
XMLPUBFUN size_t XMLCALL xmlBufUse(const xmlBufPtr buf)
XMLPUBFUN int XMLCALL xmlNodeGetSpacePreserve(const xmlNode *cur)
XMLPUBFUN xmlChar *XMLCALL xmlGetNoNsProp(const xmlNode *node, const xmlChar *name)
XMLPUBFUN xmlChar *XMLCALL xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace)
XMLPUBFUN void XMLCALL xmlFreeNsList(xmlNsPtr cur)
XMLPUBFUN void XMLCALL xmlUnlinkNode(xmlNodePtr cur)
XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreate(void)
XMLPUBFUN xmlChar *XMLCALL xmlNodeGetBase(const xmlDoc *doc, const xmlNode *cur)
XMLPUBFUN size_t XMLCALL xmlBufShrink(xmlBufPtr buf, size_t len)
@ XML_BUFFER_ALLOC_IMMUTABLE
@ XML_BUFFER_ALLOC_DOUBLEIT
xmlParserCtxt * xmlParserCtxtPtr
XMLPUBFUN int XMLCALL xmlBufGetNodeContent(xmlBufPtr buf, const xmlNode *cur)
XMLPUBFUN int XMLCALL xmlIsBlankNode(const xmlNode *node)
XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocText(const xmlDoc *doc, const xmlChar *content)
XMLPUBFUN void XMLCALL xmlFreeNs(xmlNsPtr cur)
XMLPUBFUN long XMLCALL xmlGetLineNo(const xmlNode *node)
XMLPUBFUN void XMLCALL xmlFreeNode(xmlNodePtr cur)
XMLPUBFUN xmlChar *XMLCALL xmlNodeGetLang(const xmlNode *cur)
XMLPUBFUN int XMLCALL xmlBufferCat(xmlBufferPtr buf, const xmlChar *str)
XMLPUBFUN xmlChar *XMLCALL xmlSplitQName2(const xmlChar *name, xmlChar **prefix)
XMLPUBFUN void XMLCALL xmlBufferSetAllocationScheme(xmlBufferPtr buf, xmlBufferAllocationScheme scheme)
XMLPUBFUN xmlChar *XMLCALL xmlBufContent(const xmlBuf *buf)
XMLPUBFUN xmlChar *XMLCALL xmlNodeListGetString(xmlDocPtr doc, const xmlNode *list, int inLine)
XMLPUBFUN xmlNodePtr XMLCALL xmlDocCopyNode(xmlNodePtr node, xmlDocPtr doc, int recursive)
Character const *const prefix
XMLPUBFUN xmlChar *XMLCALL xmlCanonicPath(const xmlChar *path)
XML_DEPRECATED XMLPUBFUN void XMLCALL xmlFreeRefTable(xmlRefTablePtr table)
XMLPUBFUN void XMLCALL xmlFreeIDTable(xmlIDTablePtr table)
void int int ULONGLONG int va_list * ap
XMLPUBFUN char *XMLCALL xmlParserGetDirectory(const char *filename)
XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer(xmlParserInputBufferPtr in)
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlAllocParserInputBuffer(xmlCharEncoding enc)
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc)
int(XMLCALL * xmlInputReadCallback)(void *context, char *buffer, int len)
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateStatic(const char *mem, int size, xmlCharEncoding enc)
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc)
XMLPUBFUN int XMLCALL xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len)
int(XMLCALL * xmlInputCloseCallback)(void *context)
XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc)
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserValidityWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
XMLPUBFUN void XMLCDECL xmlParserError(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserValidityError(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
void(XMLCDECL *) typedef void(XMLCALL * xmlStructuredErrorFunc)(void *userData, xmlErrorPtr error)
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
@ XML_PARSER_SEVERITY_ERROR
@ XML_PARSER_SEVERITY_WARNING
@ XML_PARSER_SEVERITY_VALIDITY_WARNING
@ XML_PARSER_SEVERITY_VALIDITY_ERROR
XMLPUBFUN xmlChar *XMLCALL xmlStrcat(xmlChar *cur, const xmlChar *add)
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
XMLPUBFUN int XMLCALL xmlStrlen(const xmlChar *str)
#define LIBXML_ATTR_FORMAT(fmt, args)
#define LIBXML_XINCLUDE_ENABLED