Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - xs:any processContents="skip" and xsi:type >Thread Next - Re: xs:any processContents="skip" and xsi:type Re: xs:any processContents="skip" and xsi:typeTo: 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/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
