1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-08-01 10:06:59 +03:00

applied patch from Steve Ball to make a schema parser from a preparsed

* xmlschemas.c include/libxml/xmlschemas.h: applied patch
  from Steve Ball to make a schema parser from a preparsed document.
Daniel
This commit is contained in:
Daniel Veillard
2003-10-29 13:21:47 +00:00
parent e22dd5ce8c
commit 9d751504d5
3 changed files with 38 additions and 0 deletions

View File

@ -3183,6 +3183,35 @@ xmlSchemaNewMemParserCtxt(const char *buffer, int size)
return (ret);
}
/**
* xmlSchemaNewDocParserCtxt:
* @doc: a preparsed document tree
*
* Create an XML Schemas parse context for that document.
* NB. The document may be modified during the parsing process.
*
* Returns the parser context or NULL in case of error
*/
xmlSchemaParserCtxtPtr
xmlSchemaNewDocParserCtxt(xmlDocPtr doc)
{
xmlSchemaParserCtxtPtr ret;
if (doc == NULL)
return (NULL);
ret = (xmlSchemaParserCtxtPtr) xmlMalloc(sizeof(xmlSchemaParserCtxt));
if (ret == NULL) {
xmlSchemaPErrMemory(NULL, "allocating schema parser context",
NULL);
return (NULL);
}
memset(ret, 0, sizeof(xmlSchemaParserCtxt));
ret->doc = doc;
return (ret);
}
/**
* xmlSchemaFreeParserCtxt:
* @ctxt: the schema parser context
@ -4224,6 +4253,8 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt)
}
doc->URL = xmlStrdup(BAD_CAST "in_memory_buffer");
ctxt->URL = xmlStrdup(BAD_CAST "in_memory_buffer");
} else if (ctxt->doc != NULL) {
doc = ctxt->doc;
} else {
xmlSchemaPErr(ctxt, NULL,
XML_SCHEMAP_NOTHING_TO_PARSE,