[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Restricted element content

From: Michael Kay <mike@saxonica.com>
Date: Thu, 12 Mar 2009 12:48:29 -0000
To: "'Vity'" <vitywap@seznam.cz>, <xmlschema-dev@w3.org>
Message-ID: <CD8AA2CB2533411BB6F2A8045A8C9410@Sealion>
RE: Restricted element content
XSD 1.0 does not allow you to constrain the content of the text nodes in
mixed content.

It's worth bearing in mind that XSD was never designed to allow you to
describe arbitrary XML instance documents.  Rather it was designed to
support a particular set of widely used XML design patterns. Holding
structured data in mixed content elements is probably not a good idea; you
would be better off wrapping the positive integer in another child element.
This will be much easier to process in XSLT or XQuery.

With assertions in XSD 1.1, however, you can do what you like.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Vity
> Sent: 11 March 2009 18:17
> To: xmlschema-dev@w3.org
> Subject: Restricted element content
> 
> Hello,
> I have very simple question, but I cannot find a solution for this.
> I would like to create XSD, which would describe following 
> piece of XML:
> <foo atr1="some restricted attribute">
>   --limited string length (or eg. positive integer)--
>   <bar1 />
>   <bar2 />
> </foo>
> 
> =element with an attribute which contains restricted content 
> and other elements. 
> 
> I have no problem to describe the XML without "bar" elements, 
> but it seems to have no solution with them.
> 
> Thanks in advance.
> 
> -Vity
> 
> 
> 
Received on Thursday, 12 March 2009 12:49:21 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.