[
Lists Home |
Date Index |
Thread Index
]
> -----Original Message-----
> From: John Cowan [mailto:jcowan@reutershealth.com]
> Sent: Friday, June 21, 2002 2:46 PM
> To: Dare Obasanjo
> Cc: John Cowan; Rick Taylor; xml-dev@lists.xml.org
> Subject: Re: [xml-dev] XML Schema to relaxNG xslt
> > does RELAX NG mimic restrictions (especially the nested ones) that
> > involve facets like xs:minInclusive, xs:maxInclusive?
>
> RNG can specify constraints on simple types,
RELAX NG can specify pattern constraints but I haven't seen the ability
to specify ranges which is what xs:minInclusive, xs:maxInclusive et al
do. Can I specify a type that is a date between 1990 and 2000 or a time
between 9:00AM and 5:00 PM in RELAX NG?
On looking at the tutorial it seems this could be done if a RELAX NG
implementation supported the W3C XML Schema Datatypes recommendation as
a type library and implemented the facets as datatype parameters.
However I don't see anything that implies that an implementation with
such functionality exists or is forthcoming.
> but not nested constraints.
Thought so.
> How does one restrict complex types in WXS?
A restriction of a complex type is a type that validates a subset of
what the base type does. An example is
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- base type -->
<xs:complexType name="XML-Deviant">
<xs:sequence>
<xs:element name="numPosts" type="xs:integer" minOccurs="0"
maxOccurs="1" />
<xs:element name="signature" type="xs:string" nillable="true" />
</xs:sequence>
<xs:attribute name="firstSubscribed" type="xs:date" use="required" />
<xs:attribute name="mailReader" type="xs:string"/>
</xs:complexType>
<!-- derived type -->
<xs:complexType name="DareObasanjo">
<xs:complexContent>
<xs:restriction base="XML-Deviant">
<xs:sequence>
<xs:element name="numPosts" type="xs:integer" minOccurs="1" />
<xs:element name="signature" type="xs:string" nillable="false" />
</xs:sequence>
<xs:attribute name="firstSubscribed" type="xs:date" use="optional" />
<xs:attribute name="mailReader" type="xs:string" fixed="Microsoft
Outlook" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
> In the spec:
>
http://www.oasis-open.org/committees/relax-ng/spec-20011203.html#IDAG3YR
>
>Section 4.7, 3rd paragraph.
Funny enough I found the language in the spec as hard to parse as when I
first started reading the
W3C XML Schema Structures recommendation less than a year ago.
>In the tutorial:
>
>http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html#ID
A3PZR
Ahhh, much better. Too bad W3C XML Schema Primer doesn't do as complete
a job as the RELAX NG tutorial.
--
PITHY WORDS OF WISDOM
No one wants constructive criticism. It's all we can do to put up with
constructive praise.
This posting is provided "AS IS" with no warranties, and confers no
rights.
|