Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: MSXML 4.0 to 6.0 - Invalid Namespace And XMLSchemaCache

From: Leverd@-----------.---------.---
To: NULL
Date: 11/13/2008 6:42:00 AM
You're absolutely correct. I used the xs:any element in my schema and my test 
case behaves correctly in both 4.0 and 6.0. Thanks again for the help! Thanks 
to you I not only fixed the problem, but have a better understanding of XML 
and XML schemas.

"Martin Honnen" wrote:

> Leverd wrote:
> 
> > <pf1:root xmlns:pf1="http://example.com/2008/ns1">
> >    <pf1:foo xmlns:pf2="http://example.com/2008/ns3">
> >      <pf2:bar>foobar</pf2:bar>
> >    </pf1:foo>
> > </pf1:root>
> > 
> > 
> > If I run the above I will get no error from MSXML6.0, but will get an error 
> > for 
> > MSXML 4.0. If I change 'n3' to 'n2', it tries to validate in both 6.0 and 
> > 4.0 (gives me an error because 'foobar' is not an int type).
> > 
> > So this might be some internal quirk that changed from 4.0 to 6.0, but the 
> > real problem is likely with my schemas. Is this a valid way to write a schema?
> 
> MSXML 4 says "The element 'pf2:bar' is used but not declared in the 
> DTD/Schema." That statement is correct as it is true that the element 
> pf2:bar occurs in the XML document but is in a namespace for which there 
> is no schema. On the other hand your XML schema simply has
> 
>     <xs:element name="root">
>       <xs:complexType>
>         <xs:sequence>
>           <xs:element name="foo"></xs:element>
>         </xs:sequence>
>       </xs:complexType>
>     </xs:element>
> </xs:schema>
> 
> With that definition the foo element is allowed to have any content that 
> is possible, see http://www.w3.org/TR/xmlschema-0/#anyType.
> 
> So what MSXML 4 reports can only be considered correct if it is meant as 
> a warning.
> 
> And MSXML 6 is correct not to report an error as there is no error, your 
> schema allows any content.
> 
> Unfortunately you have run into a difference between MSXML 4 and 6 which 
> bites you. I don't know how to solve that by changing the code using 
> MSXML 6, instead I can only suggest to change the schema to make it more 
> rigid, as in the example I posted where the foo contents was restricted 
> to be a  bar element from a certain namespace. If you don't want to 
> allow a certain element from that namespace but all possible elements 
> from a certain namespace then you can also use the xs:any element e.g.
>    <xs:element name="foo">
>      <xs:complexType>
>        <xs:sequence>
>          <xs:any namespace="http://example.com/2008/ns"/>
>        </xs:sequence>
>      </xs:complexType>
>    </xs:element>
> That way any element from a different namespace should raise a 
> validation error.
> 
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://JavaScript.FAQTs.com/
> 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent