% $Id: XMLSchemaAttrs.lsl,v 1.3 2000/01/17 21:33:41 connolly Exp $


  1. XML Schema Part 1: Structures
    internal draft: Id: structures.xml,v 1999/10/26 16:23:30 ht Exp

% should use FiniteMap/PointwiseImage, c.f. XMLNames

XMLSchemaAttrs: trait
        Set(Component, FiniteSet[AttrDecl] for Set[E])

        AttrDecl tuple of
            name: Name,
            type: SimpleTypeDefinition,
            min: ZeroOrOne,
            max: ZeroOrOne,
            vc: ValueConstraint

        ZeroOrOne enumeration of 0, 1

        ValueConstraint union of
            null: Null,
                default: List[Char],
            fixed: List[Char]

        AttributeItemOrNull union of
            null: Null,
            value: AttributeItem

        schema_valid_attrs: FiniteSet[AttributeItem], FiniteSet[AttrDecl], FiniteSet[Component] ® Bool
        lookup_attr: List[Char], TargetNS, FiniteSet[AttributeItem] ® AttributeItemOrNull

            ads: FiniteSet[AttrDecl],
            comp: Component

            (comp Î ads) Þ (tag(comp.dex) = attrDecl)
            ad: AttrDecl

            ad.min=1 Þ ad.max=1;
            ad.max=0 Þ ad.min=0

            name: List[Char],
            ais: FiniteSet[AttributeItem],
            aion: AttributeItemOrNull,
            tns: TargetNS,
            ai: AttributeItem,
            uris: FiniteSet[URIwf],
            uri: URIwf

%@@ HELP DAN -- the lookup here is hopelessly bogus -- how
% do I get to the AttributeItem's actual namespace, if any?
            (lookup_attr(name,tns,ais) = aion) =
             ($ ai (tag(aion)=value Ù aion.value=ai Ù (ai Î ais)
                      Ù (asString(localPart(name(ai)))=name)
                      Ù ((prefix(name(ai))=empty Ù tag(tns)=null)
                          Ú ((URI(ai)=uris) Ù (size(uris)=1)
                              Ù (uri Î uris))))
                    Ú (tag(aion)=null))

            attrs: FiniteSet[AttributeItem],
            ads: FiniteSet[AttrDecl],
            ccs: FiniteSet[Component],
            req: FiniteSet[AttrDecl],
            opt: FiniteSet[AttrDecl],
            absent: FiniteSet[AttrDecl],
            ad: Component
            schema_valid_attrs(attrs,ads,ccs) =

% required, optional and absent partition the declarations
            ((req \subset ads) Ù
             (opt \subset ads) Ù
             (absent \subset ads) Ù
             (((req \U opt) \U absent) = ads) Ù
             ((ad Î absent) Û (tag(ad.dex)=attrDecl Ù
                                  ad.dex.attrDecl.max = 0)) Ù
             ((ad Î req) Û (tag(ad.dex)=attrDecl Ù
                               ad.dex.attrDecl.min = 1)))



HTML generated using lsl2html.