Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: xsd:any validation for elements

From: "Shlomo Yona" <S.Yona@--.--->
To: <dmaze@--.---.--->
Date: 3/6/2007 12:30:00 PM
Hello,

 

Thanks for the reply.

 

Your example with the =93strict=94 option and importing schema does help =
understand, so I think I got the motivation for the =93strict=94 option.

 

I don=92t seem to understand the exceptions that you mention with =
regards to xsi:type. Can you please explain, or better yet, point me to =
the relevant text in the standard?

 

Thanks again.

 

Shlomo.

 

________________________________

From: dmaze@u... [mailto:dmaze@u...] 
Sent: =E2 06 =EE=F8=F5 2007 22:58
To: Shlomo Yona
Cc: xmlschema-dev@w...
Subject: Re: xsd:any validation for elements

 


xmlschema-dev-request@w... wrote on 03/06/2007 10:56:09 AM:

> I=92m not sure that I=92m clear about the parsing instructions for 
> xsd:any. Your help in interpretation of the standard is most =
appreciated: 
>   
> The =93skip=94 parser instruction in xsd:any says (I think) =96 only 
> perform well formedness and namespace checks but don=92t try to 
> validate element names and types. 

This isn't quite true.  If the content contains an xsi:type attribute, =
then in all cases the element will be validated against that type.  In =
the "skip" case it's not checked against an element declaration.  But =
otherwise, in the absence of xsi:type, yes, this passes everything =
through without validation. 

> The =93lax=94 parser instruction in xsd:any says (I think) =96 same as =

> skip but if you encounter an element name that is defined in your 
> schema, then validate it against the schema. 
> The =93strict=94 says (I think) =96 same as =93lax=94 but if you =
don=92t know 
> the element name =96 it is a validation error. 

Again, xsi:type matters here: even against a strict wildcard, an element =
without a corresponding global element declaration can still be =
considered valid if it has a valid xsi:type attribute, and the element =
is valid as per the type it declares. 

> The following things make me think that I misinterpret the standard =
correctly: 
> Why use =93strict=94? you might as well not defined your content group =
as xsd:any. 

It's much easier to specify one xs:any in your schema than a choice of =
dozens (or more!) specific named elements.  If you're importing things =
from other namespaces, you might not even know off hand what all of the =
potential options are.  And if you add global element declarations (or =
if a schema you import adds them) then a strict xs:any will =
automatically pick those up. 

> The =93lax=94 confuses me because I=92m not sure if when I encounter =
<a> I
> should make sure that all its child elements and attributes conform 
> with the schema or just <a> itself with its attributes 

There's no way in XML Schema to cause the validator to look at an =
element's attributes but ignore the content model in the same complex =
type (excepting an xsi:nil in the instance document).  I read the spec =
as requiring a validator to try to validate an element against (1) a =
matching global element declaration, (2) an xsi:type attribute, or =
failing those (3) the same way as a skip wildcard. 

David Maze
Engineer, IBM WebSphere DataPower SOA Appliances
One Rogers Street, Cambridge, MA 02142
Phone: 617-693-1306  Fax: 617-693-5541



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