DSD for DSDs
Root Element: maindsd
DSD version: 1.0

Title:DSD for DSDs
Version:1.0
Author:Nils Klarlund, Anders Moeller, and Michael I. Schwartzbach


This document is a valid DSD that describes DSD validity. For more information about DSD, see the DSD home page at http://www.brics.dk/DSD/.
<!-- GENERAL CONCEPTS -->
<DSD> ID=maindsd:
IDRef=? [Required] PointsTo ElementDef;
DSDVersion="1.0" [Required];
Content dsdcontent
</DSD>
<DSD> ID=subdsd:
IDRef=? [Optional] PointsTo ElementDef;
DSDVersion="1.0" [Required];
Content dsdcontent
</DSD>
ContentDef ID=dsdcontent:
( <Title>
Content content
</Title>?,
<Version>
Content content
</Version>?,
<Author>
Content content
</Author>?,
( Content doc,
( Element subdsd |
Element default |
Content structdef))*)
ContentDef ID=structdef:
( Element elementdef |
Element constraintdef |
Element attributedecldef |
Element contentdef |
Element booldef |
Element contextdef |
Element stringtypedef)
ContentDef ID=doc:
( <Label>
Content content
</Label>?,
<BriefDoc>
Content content
</BriefDoc>?,
<Doc>
Content content
</Doc>?)
<!-- DEFAULTS -->
<Default> ID=default:
Content boolexp?;
( Element defattribute |
Element defcontent)*
</Default>
<DefaultAttribute> ID=defattribute:
Name=? [Required];
Value=? [Required]
</DefaultAttribute>
<DefaultContent> ID=defcontent:
(Content element | StringType )
</DefaultContent>
<!-- ELEMENT DESCRIPTIONS -->
<Element> ID=elementdescr:
IDRef=? [Optional] PointsTo ElementDef;
Name=? [Optional];
Defaultable="YesOrNo" [Optional];
OneOf {Attribute IDRef, Attribute Name};
If Attribute Name
Then {Content constraintexp}
</Element>
<ElementDef> ID=elementdef:
ID=? [Required];
Name=? [Optional];
Defaultable="YesOrNo" [Optional];
Content constraintexp
</ElementDef>
<!-- CONSTRAINTS -->
<Constraint> ID=constraint:
IDRef=? [Optional] PointsTo ConstraintDef;
CurrIDRef=? [Optional] PointsTo ConstraintDef;
Not {Attribute IDRef And Attribute CurrIDRef};
If Not {Attribute IDRef Or Attribute CurrIDRef}
Then {Content constraintexp}
</Constraint>
<ConstraintDef> ID=constraintdef:
ID=? [Optional];
RenewID=? [Optional] PointsTo ConstraintDef;
OneOf {Attribute ID, Attribute RenewID};
Content constraintexp
</ConstraintDef>
ContentDef ID=constraintexp:
(Content doc, Content constraintterm)*
ContentDef ID=constraintterm:
<!-- NOTE: condconstraint must be before contentexp to resolve If ambiguity correctly -->
( Element attributedecl |
Content condconstraint |
Content contentexp |
Content boolexp |
Element constraint)
ContentDef ID=condconstraint:
<If>
( Content boolexp,
<Then>
</Then>,
<Else>
</Else>?)
</If>
<!-- ATTRIBUTE DECLARATIONS -->
<AttributeDecl> ID=attributedecl:
IDRef=? [Optional] PointsTo AttributeDeclDef;
CurrIDRef=? [Optional] PointsTo AttributeDeclDef;
Not {Attribute IDRef And Attribute CurrIDRef};
If Not {Attribute IDRef Or Attribute CurrIDRef}
Then {
Name=? [Required];
Constraint attrdeclattrs;
Content attrdeclcontent}
</AttributeDecl>
<AttributeDeclDef> ID=attributedecldef:
ID=? [Optional];
RenewID=? [Optional] PointsTo AttributeDeclDef;
OneOf {Attribute ID, Attribute RenewID};
Name=? [Required];
Constraint attrdeclattrs;
Content attrdeclcontent
</AttributeDeclDef>
ConstraintDef ID=attrdeclattrs:
Optional="YesOrNo" [Optional];
IDType="IDType" [Optional]
ContentDef ID=attrdeclcontent:
( Content stringtypeexp?,
If Attribute IDType=("IDRef" | "CurrIDRef" | "RenewID")
Then {( Content doc,
Element pointsto)?})
StringTypeDef ID=IDType:
("ID" | "IDRef" | "RenewID" | "CurrIDRef")
<PointsTo> ID=pointsto:
Content boolexp
</PointsTo>
<!-- ATTRIBUTE DESCRIPTIONS -->
<Attribute> ID=attributedescr:
Name=? [Required];
Value=? [Optional];
If Not Attribute Value
Then {Content stringtypeexp?}
</Attribute>
<!-- CONTENT DESCRIPTIONS -->
<Content> ID=contentdescr:
IDRef=? [Optional] PointsTo ContentDef;
CurrIDRef=? [Optional] PointsTo ContentDef;
Not {Attribute IDRef And Attribute CurrIDRef};
If Not {Attribute IDRef Or Attribute CurrIDRef}
Then {Content contentexp}
</Content>
<ContentDef> ID=contentdef:
ID=? [Optional];
RenewID=? [Optional] PointsTo ContentDef;
OneOf {Attribute ID, Attribute RenewID};
Content contentexp
</ContentDef>
ContentDef ID=contentexp:
( Content doc,
( <Sequence>
Content contentexp*
</Sequence> |
<Optional>
Content contentexp
</Optional> |
<ZeroOrMore>
Content contentexp
</ZeroOrMore> |
<OneOrMore>
Content contentexp
</OneOrMore> |
<Union>
Content contentexp*
</Union> |
<AnyElement/> |
<Empty/> |
<If>
( Content boolexp,
<Then>
Content contentexp
</Then>,
<Else>
Content contentexp
</Else>?)
</If> |
Element stringtype |
Element elementdescr |
Element contentdescr))
<!-- BOOLEAN FORMULAS -->
<Bool> ID=boolformula:
IDRef=? [Optional] PointsTo BoolDef;
CurrIDRef=? [Optional] PointsTo BoolDef;
Not {Attribute IDRef And Attribute CurrIDRef};
If Not {Attribute IDRef Or Attribute CurrIDRef}
Then {Content boolexp}
</Bool>
<BoolDef> ID=booldef:
ID=? [Optional];
RenewID=? [Optional] PointsTo BoolDef;
OneOf {Attribute ID, Attribute RenewID};
Content boolexp
</BoolDef>
ContentDef ID=boolexp:
( Content doc,
( <And>
Content boolexp*
</And> |
<Or>
Content boolexp*
</Or> |
<OneOf>
Content boolexp*
</OneOf> |
<Not>
Content boolexp*
</Not> |
<Imply>
(Content boolexp, Content boolexp)
</Imply> |
<Equiv>
Content boolexp*
</Equiv> |
Element attributedescr |
Element contextpattern |
Element boolformula))
<!-- CONTEXT PATTERNS -->
<Context> ID=contextpattern:
IDRef=? [Optional] PointsTo ContextDef;
CurrIDRef=? [Optional] PointsTo ContextDef;
Not {Attribute IDRef And Attribute CurrIDRef};
If Not {Attribute IDRef Or Attribute CurrIDRef}
Then {Content contextexp}
</Context>
<ContextDef> ID=contextdef:
ID=? [Optional];
RenewID=? [Optional] PointsTo ContextDef;
OneOf {Attribute ID, Attribute RenewID};
Content contextexp
</ContextDef>
ContentDef ID=contextexp:
(Content doc, Content contextterm)*
ContentDef ID=contextterm:
( Element elementpattern |
<SomeElements/> |
Element contextpattern)
<Element> ID=elementpattern:
IDRef=? [Optional] PointsTo ElementDef;
Name=? [Optional];
Not {Attribute IDRef And Attribute Name};
( Content doc,
Element attributedescr)*
</Element>
<!-- STRING TYPES -->
<StringType> ID=stringtype:
IDRef=? [Optional] PointsTo StringTypeDef;
CurrIDRef=? [Optional] PointsTo StringTypeDef;
Not {Attribute IDRef And Attribute CurrIDRef};
If Not {Attribute IDRef Or Attribute CurrIDRef}
Then {Content stringtypeexp?}
</StringType>
<StringTypeDef> ID=stringtypedef:
ID=? [Optional];
RenewID=? [Optional] PointsTo StringTypeDef;
OneOf {Attribute ID, Attribute RenewID};
Content stringtypeexp
</StringTypeDef>
ContentDef ID=stringtypeexp:
( Content doc,
( <Sequence>
Content stringtypeexp*
</Sequence> |
<Optional>
</Optional> |
<ZeroOrMore>
</ZeroOrMore> |
<OneOrMore>
</OneOrMore> |
<Union>
Content stringtypeexp*
</Union> |
<Intersection>
Content stringtypeexp*
</Intersection> |
<Complement>
</Complement> |
<Repeat>
Value="Numeral" [Required];
</Repeat> |
<AnyChar/> |
<Empty/> |
<String>
Value=? [Required]
</String> |
<CharSet>
Value=? [Required]
</CharSet> |
<CharRange>
Start="Char" [Required];
End="Char" [Required]
</CharRange> |
Element stringtype))
<!-- COMMON SYNTACTIC CONSTRUCTS -->
StringTypeDef ID=Char:
AnyChar
StringTypeDef ID=YesOrNo:
("yes" | "Yes" | "no" | "No")
StringTypeDef ID=Numeral:
[0-9]+
ContentDef ID=element:
AnyElement
ContentDef ID=content:
(AnyElement | StringType )*