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

Function xmlReaderForMemory

ThirdParty/libxml2/vtklibxml2/xmlreader.c:5190–5212  ·  view source on GitHub ↗

* xmlReaderForMemory: * @buffer: a pointer to a char array * @size: the size of the array * @URL: the base URL to use for the document * @encoding: the document encoding, or NULL * @options: a combination of xmlParserOption * * Create an xmltextReader for an XML in-memory document. * The parsing flags @options are a combination of xmlParserOption. * * Returns the new reader or NULL

Source from the content-addressed store, hash-verified

5188 * Returns the new reader or NULL in case of error.
5189 */
5190xmlTextReaderPtr
5191xmlReaderForMemory(const char *buffer, int size, const char *URL,
5192 const char *encoding, int options)
5193{
5194 xmlTextReaderPtr reader;
5195 xmlParserInputBufferPtr buf;
5196
5197 buf = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE);
5198 if (buf == NULL) {
5199 return (NULL);
5200 }
5201 reader = xmlNewTextReader(buf, URL);
5202 if (reader == NULL) {
5203 xmlFreeParserInputBuffer(buf);
5204 return (NULL);
5205 }
5206 reader->allocs |= XML_TEXTREADER_INPUT;
5207 if (xmlTextReaderSetup(reader, NULL, URL, encoding, options) < 0) {
5208 xmlFreeTextReader(reader);
5209 return (NULL);
5210 }
5211 return (reader);
5212}
5213
5214/**
5215 * xmlReaderForFd:

Callers 3

streamFileFunction · 0.85
xmlReaderForDocFunction · 0.85
streamMemParseTestFunction · 0.85

Calls 5

xmlNewTextReaderFunction · 0.85
xmlFreeParserInputBufferFunction · 0.85
xmlTextReaderSetupFunction · 0.85
xmlFreeTextReaderFunction · 0.85

Tested by 1

streamMemParseTestFunction · 0.68