[xml] validate by schema works but only after reparsing ?
- From: Peter Sobisch <petersob gmx net>
- To: xml gnome org
- Subject: [xml] validate by schema works but only after reparsing ?
- Date: Fri, 4 Jul 2003 11:24:05 +0200
Hi,
I studied the testSchema.c file and write my own program for schema validation.
If I try to validate the xml-Doc (xmlSchemaValidateDoc) I get rc=10
(XML_SCHEMAS_ERR_ELEMCONT) but, if if write the doc out (xmlSaveFormatFile)
and parse it again (xmlParseFile) the validation is successful (rc=0).
I use the libxml2 2.5.7 on Solaris 2.6.
What I do is (in the using order):
xmlParseFile()
xmlNodeSetName() ( to rename a node)
xmlUnlinkNode() \ both for remove a node
xmlFreeNode() /
xmlNewNode() (to create a new node)
xmlNodeSetContent() (to set a content of the created node)
xmlAddNodeSibling() (to insert the created node)
and than some xmlNewChild() (just append some new nodes)
now going to validate by a schema:
xmlSchemaNewParserCtxt()
xmlSchemaParse()
xmlSchemaFreeParserCtxt()
xmlSchemaNewValidCtxt()
xmlSchemaValidateDoc() <- here comes rc=10
xmlSchemaFreeValidCtxt()
xmlSaveFormatFile()
xmlFreeDoc()
xmlParseFile()
xmlSchemaNewParserCtxt()
xmlSchemaParse()
xmlSchemaFreeParserCtxt()
xmlSchemaNewValidCtxt()
xmlSchemaValidateDoc() <- here comes rc=0
xmlSchemaFreeValidCtxt()
xmlFreeDoc()
for location purposes I use the XPath API (which works very well).
I have no idea where is the difference, I already checked the Doc- and Ns-pointer
and the types (node->type) of each node but there are no differencies between the doc I
try to validate before writing and the doc after writing and parsing.
Do you have any hints what can I do or check ?
Maybe I have do something with the doc after I did changes but befor I'm going to reparse
it ? But what ?
Thanks in advance !
with best regards
Peter Sobisch
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]