* xmlCreateMemoryParserCtxt: * @buffer: a pointer to a char array * @size: the size of the array * * Create a parser context for an XML in-memory document. The input buffer * must not contain a terminating null byte. * * Returns the new parser context or NULL */
| 13040 | * Returns the new parser context or NULL |
| 13041 | */ |
| 13042 | xmlParserCtxtPtr |
| 13043 | xmlCreateMemoryParserCtxt(const char *buffer, int size) { |
| 13044 | xmlParserCtxtPtr ctxt; |
| 13045 | xmlParserInputPtr input; |
| 13046 | |
| 13047 | if (size < 0) |
| 13048 | return(NULL); |
| 13049 | |
| 13050 | ctxt = xmlNewParserCtxt(); |
| 13051 | if (ctxt == NULL) |
| 13052 | return(NULL); |
| 13053 | |
| 13054 | input = xmlNewInputMemory(ctxt, NULL, buffer, size, NULL, 0); |
| 13055 | if (input == NULL) { |
| 13056 | xmlFreeParserCtxt(ctxt); |
| 13057 | return(NULL); |
| 13058 | } |
| 13059 | inputPush(ctxt, input); |
| 13060 | |
| 13061 | return(ctxt); |
| 13062 | } |
| 13063 | |
| 13064 | #ifdef LIBXML_SAX1_ENABLED |
| 13065 | /** |
no test coverage detected