W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2011

Re: XML Schema programming idiom: gathering up all the constraints on a simpleType

From: Mukul Gandhi <gandhi.mukul@gmail.com>
Date: Wed, 27 Apr 2011 16:23:06 +0530
Message-ID: <BANLkTikigLDb0jPvjo4B9RqUNoiLtE5nww@mail.gmail.com>
To: "Costello, Roger L." <costello@mitre.org>
Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
By defining a user defined simpleType, we are actually defining the
value space of the simpleType (which could be from restriction of
another simple type, a list, or union of value spaces of member
types).

The fundamental means of doing this in XML Schema language is by using
facets, itemType (for variety list) and memberTypes (for variety
union).

Borrowing the terminology from Xerces's XML Schema API, following are
the primary operations that can be done on a simpleType definition,

getFacets,
getMultiValuedFacets,
getItemType &
getMemberTypes

Perhaps this can give some food for thought, for this question!

On Wed, Apr 27, 2011 at 3:11 PM, Costello, Roger L. <costello@mitre.org> wrote:
> Hi Folks,
>
> One activity that I frequently perform when processing XML Schemas is this:
>
>     I have a simpleType and I need to know
>     all the constraints on it.
>
> Example: consider this simpleType:
>
>    <xsd:simpleType name="BostonAreaSurfaceElevation">
>        <xsd:restriction base="elev:EarthSurfaceElevation">
>            <xsd:minInclusive value="0"/>
>            <xsd:maxInclusive value="120"/>
>        </xsd:restriction>
>    </xsd:simpleType>
>
> What are all the constraints on it? Well, it identifies a base type, elev:EarthSurfaceElevation. That base type may contain some constraints that must be considered. Further, that base type may have a base type, which has a base type, etc. That entire dependency tree must be considered.
>
> Determining all the constraints on a simpleType is an important programming idiom (at least, it is for my applications).
>
> What would you name this programming idiom? I have been naming it "simpleType accumulated restrictions" but wonder if there is a better name?
>
> Even better, is there a functional programming language (e.g., Haskell) function that does this kind of activity, or an analogous activity?
>
> /Roger




-- 
Regards,
Mukul Gandhi
Received on Wednesday, 27 April 2011 10:53:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 April 2011 10:53:57 GMT