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

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 UTC