Re: [xml] validate by schema works but only after reparsing ?



On Fri, 4 Jul 2003 05:39:16 -0400
Daniel Veillard <veillard redhat com> wrote:
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).
  First W3C XML Schemas implementation is known to be incomplete
so it comes with no garantees at all (except the garantee that it's
broken for the Structure part !).
  Second I have no idea why serializing and reparsing would change
the way the regular expression check for the content model work.
I think there is something else going on. I see no other way than
you debugging the code, deconstructing your sequence of modification
to the document until you find out why or where this fails starting
from the point which works. That's just debugging skills, start from
a document which validate and modify it and reintroduce your modification
code until you find out where this breaks ... Again it's just debugging
of your code, maybe there is an underlying error in the library, that
will allow to pinpoint it too ...

Hi Daniel and All,

I found out, that the content pointer of xmlNode will not be updated in
xmlNewChild and xmlNodeSetContent, but the XML-Schema validation seems to use it.
Parsing the data the pointer will be set properly, therefore I had have 
to save first and than reparse the data.

Is it an intentional behaviour not updating the content pointer ?

As you wrote above, the schema validation is incomplete, but what is to do:
change the schema code to get the content on other way (then: why set it on parsing)
or modify the tree-Functions to update the content pointer ?

regards,
Peter




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]