mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-07 06:43:02 +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:
@@ -1,3 +1,8 @@
|
||||
Wed Oct 29 14:20:14 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xmlschemas.c include/libxml/xmlschemas.h: applied patch
|
||||
from Steve Ball to make a schema parser from a preparsed document.
|
||||
|
||||
Wed Oct 29 13:52:25 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* tree.c: applied a couple of patches from Mark Lilback about text
|
||||
|
@@ -77,6 +77,8 @@ XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
|
||||
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
|
||||
xmlSchemaNewMemParserCtxt (const char *buffer,
|
||||
int size);
|
||||
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
|
||||
xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void XMLCALL
|
||||
|
31
xmlschemas.c
31
xmlschemas.c
@@ -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,
|
||||
|
Reference in New Issue
Block a user