MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlTextReaderSetup

Function xmlTextReaderSetup

ThirdParty/libxml2/vtklibxml2/xmlreader.c:4854–5038  ·  view source on GitHub ↗

* xmlTextReaderSetup: * @reader: an XML reader * @input: xmlParserInputBufferPtr used to feed the reader, will * be destroyed with it. * @URL: the base URL to use for the document * @encoding: the document encoding, or NULL * @options: a combination of xmlParserOption * * Setup an XML reader with new options * * Returns 0 in case of success and -1 in case of error. */

Source from the content-addressed store, hash-verified

4852 * Returns 0 in case of success and -1 in case of error.
4853 */
4854int
4855xmlTextReaderSetup(xmlTextReaderPtr reader,
4856 xmlParserInputBufferPtr input, const char *URL,
4857 const char *encoding, int options)
4858{
4859 if (reader == NULL) {
4860 if (input != NULL)
4861 xmlFreeParserInputBuffer(input);
4862 return (-1);
4863 }
4864
4865 /*
4866 * we force the generation of compact text nodes on the reader
4867 * since usr applications should never modify the tree
4868 */
4869 options |= XML_PARSE_COMPACT;
4870
4871 reader->doc = NULL;
4872 reader->entNr = 0;
4873 reader->parserFlags = options;
4874 reader->validate = XML_TEXTREADER_NOT_VALIDATE;
4875 if ((input != NULL) && (reader->input != NULL) &&
4876 (reader->allocs & XML_TEXTREADER_INPUT)) {
4877 xmlFreeParserInputBuffer(reader->input);
4878 reader->input = NULL;
4879 reader->allocs -= XML_TEXTREADER_INPUT;
4880 }
4881 if (input != NULL) {
4882 reader->input = input;
4883 reader->allocs |= XML_TEXTREADER_INPUT;
4884 }
4885 if (reader->buffer == NULL)
4886 reader->buffer = xmlBufCreateSize(100);
4887 if (reader->buffer == NULL) {
4888 return (-1);
4889 }
4890 /* no operation on a reader should require a huge buffer */
4891 xmlBufSetAllocationScheme(reader->buffer,
4892 XML_BUFFER_ALLOC_DOUBLEIT);
4893 if (reader->sax == NULL)
4894 reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
4895 if (reader->sax == NULL) {
4896 return (-1);
4897 }
4898 xmlSAXVersion(reader->sax, 2);
4899 reader->startElement = reader->sax->startElement;
4900 reader->sax->startElement = xmlTextReaderStartElement;
4901 reader->endElement = reader->sax->endElement;
4902 reader->sax->endElement = xmlTextReaderEndElement;
4903#ifdef LIBXML_SAX1_ENABLED
4904 if (reader->sax->initialized == XML_SAX2_MAGIC) {
4905#endif /* LIBXML_SAX1_ENABLED */
4906 reader->startElementNs = reader->sax->startElementNs;
4907 reader->sax->startElementNs = xmlTextReaderStartElementNs;
4908 reader->endElementNs = reader->sax->endElementNs;
4909 reader->sax->endElementNs = xmlTextReaderEndElementNs;
4910#ifdef LIBXML_SAX1_ENABLED
4911 } else {

Callers 8

xmlReaderForFileFunction · 0.85
xmlReaderForMemoryFunction · 0.85
xmlReaderForFdFunction · 0.85
xmlReaderForIOFunction · 0.85
xmlReaderNewFileFunction · 0.85
xmlReaderNewMemoryFunction · 0.85
xmlReaderNewFdFunction · 0.85
xmlReaderNewIOFunction · 0.85

Calls 15

xmlFreeParserInputBufferFunction · 0.85
xmlBufCreateSizeFunction · 0.85
xmlSAXVersionFunction · 0.85
xmlBufUseFunction · 0.85
xmlParserInputBufferReadFunction · 0.85
xmlCreatePushParserCtxtFunction · 0.85
xmlBufContentFunction · 0.85
xmlCtxtResetFunction · 0.85
xmlNewInputStreamFunction · 0.85
xmlCanonicPathFunction · 0.85

Tested by

no test coverage detected