Re: [xml] XML Schema: Validating an instance document with multiple schemas
- From: Daniel Veillard <veillard redhat com>
- To: "Paul B. Cameron" <paul b cameron kepware com>
- Cc: xml gnome org
- Subject: Re: [xml] XML Schema: Validating an instance document with multiple schemas
- Date: Thu, 26 May 2011 10:51:27 +0800
On Mon, May 23, 2011 at 03:50:37PM -0400, Paul B. Cameron wrote:
Just to be sure I'm clear, this case fails:
1.) xmlReadFile (strPrimarySchemaFile, NULL, XML_PARSE_NONET)
2.) Add targetNamespace to xs:schema node for primary schema, add
<xs:import> nodes for secondary schemas
3.) call xmlSchemaNewDocParserCtxt to create parser context and
xmlSchemaParse to parse the schema (which fails)
This smells like in doing 2 you missed something with namespaces,
and that as a result when parsing your in-memory tree teh XSD parser
fails to find the namespaces (maybe just the prefix or something.
And this case succeeds:
1.) Call xmlReadFile like before
2.) Add targetNamespace and xs:import's exactly like above
3.) Call xmlDocDumpMemory to dump to a xmlChar buffer, xmlDocFree to free
the original doc, and xmlReadDoc load the dumped buffer back into a DOM
here after serialization and reparsing the namespaces of the elements
and attributes in the tree are fine, and then everything works as
expected.
4.) Call xmlSchemaNewDocParserCtxt and xmlSchemaParse as above (and
ultimately xmlSchemaValidateDoc), which now succeed
Triple-check the namespaces pointers and of the new elements/attributes
you added to the tree, not by serializing them but by looing at the
actual ns and nsDef pointers.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]