Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Constraining a mixed type ?

From: noah_mendelsohn@--.---.---
To: "Michael Kay" <mhk@---.--.-->
Date: 4/17/2004 6:58:00 PM
Michael Kay writes:

> > I wonder if it is possible to define a constrain on a mixed 
> > content using XML Schemas. 
> 
> I don't think this is possible.
> 
> Michael Kay

Actually, a number of interesting constraints are possible.  The exact 
spec details are at [1] in the constraint named "Schema Component 
Constraint: Derivation Valid (Restriction, Complex)". 

Rather than explain this rigorously, I will try to give you the general 
spirit of the rules:

* The overall philosphy of validating mixed content is that when you see 
an instance like:

        123<X>abc</X>456<Y>def</Y>789

you ignore the character content and validate only the element content:

        <X>abc</X><Y>def</Y>

so if you have declared a sequence of X,Y this might well validate.

* Restriction of element content follows from this.  Let's imagine that 
your original model was actually (X,Y?).  From this you could derive a new 
mixed type allowing only the X which would validate:

        123<X>abc</X>456789

but not the original

        123<X>abc</X>456<Y>def</Y>789

* There is another twist.  If your base content model is like this (X?, 
Y?) then it's what the recommendation calls "emptiable", becaues all of 
its content is optional.  In that specific case you can not only derive a 
type with no element content, you can in fact derive a type with simple 
content.  Thusl, the restricted type could type the content as 
xsd:integer, for example, which would validate:

        123456789

I'm sure Henry will chime in if I've missed something, but I believe the 
above is how it works.

Noah

[1] http://www.w3.org/TR/xmlschema-1/#coss-ct

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------



From noah_mendelsohn@u...  Sat Apr 17 23:00:02 2004
Return-Path: <noah_mendelsohn@u....


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