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 UTC