* xmlReadMemory: * @buffer: a pointer to a char array * @size: the size of the array * @url: base URL (optional) * @encoding: the document encoding (optional) * @options: a combination of xmlParserOption * * Parse an XML in-memory document and build a tree. The input buffer must * not contain a terminating null byte. * * See xmlCtxtReadMemory for details. * * Returns the resulting
| 13916 | * Returns the resulting document tree |
| 13917 | */ |
| 13918 | xmlDocPtr |
| 13919 | xmlReadMemory(const char *buffer, int size, const char *url, |
| 13920 | const char *encoding, int options) |
| 13921 | { |
| 13922 | xmlParserCtxtPtr ctxt; |
| 13923 | xmlParserInputPtr input; |
| 13924 | xmlDocPtr doc; |
| 13925 | |
| 13926 | if (size < 0) |
| 13927 | return(NULL); |
| 13928 | |
| 13929 | ctxt = xmlNewParserCtxt(); |
| 13930 | if (ctxt == NULL) |
| 13931 | return(NULL); |
| 13932 | |
| 13933 | xmlCtxtUseOptions(ctxt, options); |
| 13934 | |
| 13935 | input = xmlNewInputMemory(ctxt, url, buffer, size, encoding, |
| 13936 | XML_INPUT_BUF_STATIC); |
| 13937 | |
| 13938 | doc = xmlCtxtParseDocument(ctxt, input); |
| 13939 | |
| 13940 | xmlFreeParserCtxt(ctxt); |
| 13941 | return(doc); |
| 13942 | } |
| 13943 | |
| 13944 | /** |
| 13945 | * xmlReadFd: |