Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xs:any processContents="skip" and xsi:type

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 6/4/2009 2:09:00 PM
tomthemighty@g... wrote:
> If I have a schema like this:
>  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>  	<xs:element name="foo">
>  		<xs:complexType>
>  			<xs:sequence>
>  				<xs:any processContents="skip"/>
>  			</xs:sequence>
>  		</xs:complexType>
>  	</xs:element>
>  </xs:schema>
> 
> and use it to validate a document (using MSXML) like this:
>  <foo>
>  	<bar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="wibble"/>
>  </foo>
> 
> I get the following error:
>  Supplied input XML is invalid
>    Reason: Type 'wibble' is not found in Schema.
>    Line number: 2
>    Char position: 27
>    Source XML:         <bar xsi:type="wibble"/>
>                                               ^
> 
> I think this is incorrect on MSXML's part. The
> processingContents="skip" should skip validation, but it is reporting
> a validation error because of the xsi:type attribute. 

I have used your schema and XML instance document as posted and then 
applied the following JScript program using MSXML 6:

var schemas = new ActiveXObject('Msxml2.XMLSchemaCache.6.0');
schemas.add('', 'test2009060401Xsd.xml');

var doc = new ActiveXObject('Msxml2.DOMDocument.6.0');
doc.async = false;
doc.schemas = schemas;
doc.validateOnParse = true;

if (doc.load('test2009060401.xml'))
{
   WScript.Echo('valid:\r\n' + doc.xml);
}
else
{
   WScript.Echo(doc.parseError.reason);
}

I don't get any such error as you say you get, unless I change the 
schema to use processContents="strict".

MSXML 6 used here is 6.20.1099.0 (MSXML 6.0 SP2).
-- 

	Martin Honnen --- MVP XML
	http://msmvps.com/blogs/martin_honnen/


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