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

References

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

XMLSchema: trait
    includes
        XMLInfoSet,
        XMLSchemaBasics,
        XMLSchemaString,
        XMLSchemaAttrs,
        Set(Component, FiniteSet[Component] for Set[E]),
        Set(Component, FiniteSet[AttrDecl] for Set[E])

        TypeDefinition union of
             simple: SimpleTypeDefinition,
            complex: ComplexTypeDefinition

        BaseDatatype union of
            abInitio: AbInitio,
            simple: SimpleTypeDefinition

        AbInitio union of
            string: StringAIT,
            boolean: BooleanAIT,
            real: RealAIT,
            binary: BinaryAIT,
            uri: URIAIT,
            language: LanguageAIT,
            nmtoken: NMTokenAIT,
            timeinstant: TimeInstantAIT,
            timeduration: TimeDurationAIT,
            recurringinstant: RecurringInstantAIT

        SimpleTypeDefinition tuple of
            basetype: BaseDatatype
% @@others...

        ComplexTypeDefinition tuple of
            basetype: TypeDefinition,
            contentModel: ContentModel,
            attrDecls: FiniteSet[AttrDecl]
%@@others...

        ComplexRTypeDefinition tuple of %@@subtype of above??
            contentType: ContentType,
            attrDecls: FiniteSet[AttrDecl]
%@@others...

        ContentType union of
            unconstrained: Null,
            emptyCM: Null,
            simpleType: SimpleTypeDefinition,
            richModel: ContentModel

    introduces
        schema_valid: ElementItem, TypeDefinition, FiniteSet[Component] ® Bool
        schema_valid_string: List[Char], AbInitio ® Bool
        schema_valid_content: List[Item], ComplexRTypeDefinition, FiniteSet[Component] ® Bool
        effective_stype: SimpleTypeDefinition, FiniteSet[Component]® AbInitio
        effective_ctype: ComplexTypeDefinition, FiniteSet[Component]® ComplexRTypeDefinition
        find_component: Def_or_Decl_tag, List[Char], TargetNS,  FiniteSet[Component] ® Component
        all_white: List[Char] ® Bool

    asserts
        "
             eii: ElementItem,
            tyDef: TypeDefinition,
            effectiveSchema: FiniteSet[Component]

            schema_valid(eii, tyDef, effectiveSchema) =
                (tag(tyDef) = simple
                Ù attributes(eii) = {}
                Ù filter(children(element(eii)), element) = empty
                Ù schema_valid_string(asString(children(element(eii))),
                                       effective_stype(tyDef.simple,
                                                       effectiveSchema)))
                Ú
                (tag(tyDef) = complex
                Ù schema_valid_attrs(attributes(eii),
                                      effective_ctype(tyDef.complex,
                                                    effectiveSchema).attrDecls,
                                      effectiveSchema)
                Ù schema_valid_content(children(element(eii)),
                                        effective_ctype(tyDef.complex,
                                                        effectiveSchema),
                                        effectiveSchema)
                                        )

        "
            string: List[Char],
            ait: AbInitio

            schema_valid_string(string,ait) =
              (tag(ait) = string
               Ù
               string_is_string(string,ait.string))
% @@ \/ (tag(ait) = boolean /\ ...) ...

        "
            content: List[Item],
            crt: ComplexRTypeDefinition,
            effectiveSchema: FiniteSet[Component]

            schema_valid_content(content,crt,effectiveSchema) =
                (((tag(crt.contentType) = emptyCM)
                  Ù (filter(content,element) = empty)
                  Ù all_white(asString(content)))
                 Ú
% @@ lots more clauses needed
                true)

         "
             ccs: FiniteSet[Component],
             comp: Component,
             localname: List[Char],
             tns: TargetNS,
             dd: Def_or_Decl,
             ddt: Def_or_Decl_tag
             

             (find_component(ddt,localname,tns,ccs) = comp) Û
             (comp Î ccs) Ù (comp.localname=localname) Ù (comp.tns=tns)
             Ù (comp.dex=dd) Ù (tag(dd)=ddt)

    implies
% test the simplest case
        "
            eii: ElementItem,
            td: TypeDefinition,
            ss: FiniteSet[Component],
            content: List[Item],
            i: Item,
            ci: CharacterItem,
            std: SimpleTypeDefinition,
            bt: BaseDatatype,
            ait: AbInitio,
            sait: StringAIT

            children(element(eii))=content Ù
            content={i} Ù
            tag(i)=char Ù
            tag(td)=simple Ù
            td.simple=std Ù
            std.basetype=bt Ù
            tag(bt)=abInitio Ù
            bt.abInitio=ait Ù
            tag(ait)=string Ù
            ait.string=sait Ù
            tag(sait.pattern)=null Ù
            tag(sait.maxLength)=null Ù
            tag(sait.length)=value Ù
            sait.length.value=1 Þ schema_valid(eii,td,ss)
% phew!
            
            

[Index]

[source]


HTML generated using lsl2html.