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: Sat, 11 Jun 2011 08:26:13 +0800
On Fri, Jun 10, 2011 at 10:52:45AM -0400, Paul B. Cameron wrote:
Thanks again for the assistance.
It turns out that when I add the targetNamespace, global namespace, and
prefixed namespace declarations to the physical schema files, and remove the
code that added these entries at runtime, the problem remains:
"Element '{http://www.w3.org/2001/XMLSchema}schema': The content is not
valid. Expected is ((include | import | redefine | annotation)*,
(((simpleType | complexType | group | attributeGroup) | element | attribute
| notation), annotation*)*).
I think this narrows the issue down to the dynamic addition of the
<xs:import> nodes, although the error does seem to indicate a problem with
the xs:schema element. Again, my procedure is:
1.) xmlDocGetRootElement
2.) xmlFirstElementChild (I need to insert <xs:import> as the first child of
<xs:schema>
3.) xmlNewNode with "xs:import"
4.) xmlDocCopyNode to populate the new node with doc info
5.) xmlAddPrevSibling to insert the new node in front of the previous
first-child-element.
6.) xmlSetProp with "namespace" to setup the namespace attribute
7.) xmlSetProp with "schemaLocation" to setup the file URI for the import
schema
Any chance there is a problem with using xmlSetProp for the "namespace" and
"schemaLocation" attributes?
I don't now, all I can tell, is that if you have a default namespace
in scope (xmlns="...") then those xmlSetProp'ed attributes won't inherit
the namespace, get the namespace first and then use xmlSetNsProp()
That would generate a difference in behaviour between the serialized
and reparsed tree vs. using the tree directly
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]