Added the function xmlSchemaValidateOneElement to the XML Schema
* xmlschemas.c include/libxml/xmlschemas.h: Added the function
xmlSchemaValidateOneElement to the XML Schema validation API,
as proposed by Jeffrey Fink - see bug # 152073.
diff --git a/xmlschemas.c b/xmlschemas.c
index ce4b558..12cc8c1 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -14276,6 +14276,28 @@
}
/**
+ * xmlSchemaValidateOneElement:
+ * @ctxt: a schema validation context
+ * @elem: an element node
+ *
+ * Validate a branch of a tree, starting with the given @elem.
+ *
+ * Returns 0 if the element and its subtree is valid, a positive error
+ * code number otherwise and -1 in case of an internal or API error.
+ */
+int
+xmlSchemaValidateOneElement(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr elem)
+{
+ if ((ctxt == NULL) || (elem == NULL))
+ return (-1);
+
+ ctxt->doc = elem->doc;
+ ctxt->err = 0;
+ ctxt->nberrors = 0;
+ return (xmlSchemaValidateElement(ctxt, elem));
+}
+
+/**
* xmlSchemaValidateDocument:
* @ctxt: a schema validation context
* @doc: a parsed document tree