Re: [xml] XML Schema: Validating an instance document with multiple schemas

On Wed, Jun 01, 2011 at 09:41:43AM -0400, Paul B. Cameron wrote:
The primary schema declaration looks like this on-disk:
<xs:schema xmlns:xs="";
elementFormDefault="qualified" attributeFormDefault="unqualified">

It's updated in-memory to this:
<xs:schema xmlns:xs="";
elementFormDefault="qualified" attributeFormDefault="unqualified"

To do so, I load the schema and:
1.) xmlDocGetRootElement
2.) xmlSetProp with "targetNamespace"
3.) xmlSetProp with "xmlns"

  That is wrong create a namespace with
set it as the in-scope namespace by updating the -> ns field of all the
elements in the subtree.

Is this the wrong way to go about this? Should I be using the NS-specific
API's for step 3?


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.

  I'm now sure the problem is related to building the in-memory
tree and having the namespaces correctly set.


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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