Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: xs:any processContents="skip" and xsi:type [Thread Next] Re: xs:any processContents="skip" and xsi:typeTo: NULL Date: 6/4/2009 6:58:00 AM On Jun 4, 1:09=A0pm, Martin Honnen <mahotr...@yahoo.de> wrote:
> tomthemig...@googlemail.com wrote:
> > If I have a schema like this:
> > =A0<xs:schema xmlns:xs=3D"http://www.w3.org/2001/XMLSchema">
> > =A0 =A0<xs:element name=3D"foo">
> > =A0 =A0 =A0 =A0 =A0 =A0<xs:complexType>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<xs:sequence>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<xs:any processC=
ontents=3D"skip"/>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0</xs:sequence>
> > =A0 =A0 =A0 =A0 =A0 =A0</xs:complexType>
> > =A0 =A0</xs:element>
> > =A0</xs:schema>
>
> > and use it to validate a document (using MSXML) like this:
> > =A0<foo>
> > =A0 =A0<bar xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
> > xsi:type=3D"wibble"/>
> > =A0</foo>
>
> > I get the following error:
> > =A0Supplied input XML is invalid
> > =A0 =A0Reason: Type 'wibble' is not found in Schema.
> > =A0 =A0Line number: 2
> > =A0 =A0Char position: 27
> > =A0 =A0Source XML: =A0 =A0 =A0 =A0 <bar xsi:type=3D"wibble"/>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0 =A0 =A0 ^
>
> > I think this is incorrect on MSXML's part. The
> > processingContents=3D"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 =3D new ActiveXObject('Msxml2.XMLSchemaCache.6.0');
> schemas.add('', 'test2009060401Xsd.xml');
>
> var doc =3D new ActiveXObject('Msxml2.DOMDocument.6.0');
> doc.async =3D false;
> doc.schemas =3D schemas;
> doc.validateOnParse =3D true;
>
> if (doc.load('test2009060401.xml'))
> {
> =A0 =A0WScript.Echo('valid:\r\n' + doc.xml);}
>
> else
> {
> =A0 =A0WScript.Echo(doc.parseError.reason);
>
> }
>
> I don't get any such error as you say you get, unless I change the
> schema to use processContents=3D"strict".
>
> MSXML 6 used here is 6.20.1099.0 (MSXML 6.0 SP2).
> --
>
> =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML
> =A0 =A0 =A0 =A0http://msmvps.com/blogs/martin_honnen/- Hide quoted text -
>
> - Show quoted text -
You're right, it does. And thank you! That was exactly the nudge I
needed.
It's not MSXML's fault at all - it's mine. It isn't failing at the
point I thought it was. It is failing earlier on during a simple well-
formedness check that shouldn't be doing validation, but
validateOnParse has been wrongly set to true although the schemacache
is empty (that seems to work unless that xsi:type is in there). The
actual validation step using the schema succeeds even in the presence
of the xsi:type.
Thanks for your help!
Tom
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
