* xmlReaderNewMemory: * @reader: an XML reader * @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 * * Setup an xmltextReader to parse an XML in-memory document. * The parsing flags @options are a combination of xmlParserOption. * Thi
| 5398 | * Returns 0 in case of success and -1 in case of error |
| 5399 | */ |
| 5400 | int |
| 5401 | xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size, |
| 5402 | const char *URL, const char *encoding, int options) |
| 5403 | { |
| 5404 | xmlParserInputBufferPtr input; |
| 5405 | |
| 5406 | if (reader == NULL) |
| 5407 | return (-1); |
| 5408 | if (buffer == NULL) |
| 5409 | return (-1); |
| 5410 | |
| 5411 | input = xmlParserInputBufferCreateStatic(buffer, size, |
| 5412 | XML_CHAR_ENCODING_NONE); |
| 5413 | if (input == NULL) { |
| 5414 | return (-1); |
| 5415 | } |
| 5416 | return (xmlTextReaderSetup(reader, input, URL, encoding, options)); |
| 5417 | } |
| 5418 | |
| 5419 | /** |
| 5420 | * xmlReaderNewFd: |