Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: defining elements with patterns and childelements

From: "Michael Kay" <mike@--------.--->
To: <info@-------.-->, "'XML Schema List'" <xmlschema-dev@--.--->
Date: 3/12/2008 12:15:00 AM
> 
> I spent the whole day with tinking and trying and now my head 
> is totally empty. I have the following complexType which 
> describes a listType for unordered and ordered lists:

It actually consists of a type which allows 1 to many unorderedlist elements
followed by 1 to many orderedlist elements. That seems a bit odd to me.

But more relevant to your question, in your instance the content of the
orderedlist elements is mixed (that is, it contains child text nodes as well
as child elements), and there is no way in XML Schema 1.0 to constrain the
text that appears in elements with mixed content. It can be done with
assertions in XML Schema 1.1 (still a draft spec, but implemented in Saxon
9.0, if you want to give it a try).

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

> 
>     <xs:complexType name="listType">
>         <xs:sequence>
>             <xs:element name="unorderedlist" maxOccurs="unbounded">
>                 <xs:simpleType>
>                     <xs:restriction base="xs:string">
>                         <xs:pattern value="&#x02DC;.*"/>
>                         <xs:pattern value="&#x2013;.*"/>
>                         <xs:pattern value="&#x2022;.*"/>
>                     </xs:restriction>
>                 </xs:simpleType>
>             </xs:element>
>             <xs:element name="orderedlist" maxOccurs="unbounded">
>                 <xs:simpleType>
>                     <xs:restriction base="xs:string">
>                         <xs:pattern value="[0-9].*"/>
>                         <xs:pattern value="[a-z].*"/>
>                         <xs:pattern value="[i-iiii]{1,4}.*"/>
>                     </xs:restriction>
>                 </xs:simpleType>
>             </xs:element>
>         </xs:sequence>
>     </xs:complexType>
> 
> 
> My aim: the element unorderedlist or orderedlist should start 
> with an special pattern (see above) and after the pattern it 
> should be possible to use text or other elelemts. 
> 
> Example:
> <orderedlist>1. This is an orderedlist with a 
> special<specchar> character</specchar> and again 
> text.</orderedlist> <orderedlist>2. This is an orderedlist 
> again with a special<specchar> character</specchar>.</orderedlist>
> 
> Does anyone out there have an idea how to realise such an 
> approach? I hope the question is understandable so far :-)
> 
> Thanks sooo much to everyone.
> Andreas
> 


From gkholman@C... Wed Mar 12 13:00:46 2008
Received: from aji.w3.org ([133.27.228.225]


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