[xml] Re: validating an xmlNode without an xmlDoc - solution
- From: David Grohmann <grohmann arlut utexas edu>
- To: xml gnome org
- Subject: [xml] Re: validating an xmlNode without an xmlDoc - solution
- Date: Mon, 22 May 2006 15:43:57 -0500
David Grohmann wrote:
I have code that generates and xmlNode tree that conforms to an XML
schema.
To make sure I validate it against the schema.
libxml2 gives the error below.
"Schemas validity error : Internal error: xmlSchemaVStart, no instance
to validate."
which is generated roughly on line 27679 in the newest cvs of
xmlschemas.c
http://cvs.gnome.org/viewcvs/libxml2/xmlschemas.c?rev=1.202&view=log
Now this is because we called xmlSchemaValidateOneElement(
schema_validation_context, generated_node )
since this node never was associated with a document
schema_validation_context->doc is NULL
Tree validation used to work like this in an older version of libxml2.
(2.6.17 I believe)
1. Why is a document required now?
2. How do I create an xmlDoc and associate it with my root node
or in other words make my rootnode the children of the document?
fixed my own problem, just had to add this code before I validated
doc = xmlNewDoc(BAD_CAST "1.0");
xmlDocSetRootElement(doc, node);
//validation code;
--
David Grohmann
Senior Student Associate
Applied Research Lab : UT Austin : ESL - S206
Office: 512-835-3237
Cell: 210-861-6882
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]