* 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
| 5419 | * Returns 0 in case of success and -1 in case of error |
| 5420 | */ |
| 5421 | int |
| 5422 | xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size, |
| 5423 | const char *URL, const char *encoding, int options) |
| 5424 | { |
| 5425 | xmlParserInputBufferPtr input; |
| 5426 | |
| 5427 | if (reader == NULL) |
| 5428 | return (-1); |
| 5429 | if (buffer == NULL) |
| 5430 | return (-1); |
| 5431 | |
| 5432 | input = xmlParserInputBufferCreateMem(buffer, size, |
| 5433 | XML_CHAR_ENCODING_NONE); |
| 5434 | if (input == NULL) { |
| 5435 | return (-1); |
| 5436 | } |
| 5437 | return (xmlTextReaderSetup(reader, input, URL, encoding, options)); |
| 5438 | } |
| 5439 | |
| 5440 | /** |
| 5441 | * xmlReaderNewFd: |
no test coverage detected