MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCOLLADA / htmlCreateMemoryParserCtxt

Function htmlCreateMemoryParserCtxt

Externals/LibXML/HTMLparser.c:4362–4394  ·  view source on GitHub ↗

* htmlCreateMemoryParserCtxt: * @buffer: a pointer to a char array * @size: the size of the array * * Create a parser context for an HTML in-memory document. * * Returns the new parser context or NULL */

Source from the content-addressed store, hash-verified

4360 * Returns the new parser context or NULL
4361 */
4362htmlParserCtxtPtr
4363htmlCreateMemoryParserCtxt(const char *buffer, int size) {
4364 xmlParserCtxtPtr ctxt;
4365 xmlParserInputPtr input;
4366 xmlParserInputBufferPtr buf;
4367
4368 if (buffer == NULL)
4369 return(NULL);
4370 if (size <= 0)
4371 return(NULL);
4372
4373 ctxt = htmlNewParserCtxt();
4374 if (ctxt == NULL)
4375 return(NULL);
4376
4377 buf = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE);
4378 if (buf == NULL) return(NULL);
4379
4380 input = xmlNewInputStream(ctxt);
4381 if (input == NULL) {
4382 xmlFreeParserCtxt(ctxt);
4383 return(NULL);
4384 }
4385
4386 input->filename = NULL;
4387 input->buf = buf;
4388 input->base = input->buf->buffer->content;
4389 input->cur = input->buf->buffer->content;
4390 input->end = &input->buf->buffer->content[input->buf->buffer->use];
4391
4392 inputPush(ctxt, input);
4393 return(ctxt);
4394}
4395
4396/**
4397 * htmlCreateDocParserCtxt:

Callers 4

gen_htmlParserCtxtPtrFunction · 0.85
htmlCreateDocParserCtxtFunction · 0.85
xmlParseInNodeContextFunction · 0.85

Calls 5

htmlNewParserCtxtFunction · 0.85
xmlNewInputStreamFunction · 0.85
xmlFreeParserCtxtFunction · 0.85
inputPushFunction · 0.85

Tested by 2

gen_htmlParserCtxtPtrFunction · 0.68