Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: tomthemighty@----------.---
To: 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


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