Rose – Document Type Declaration (DTD) Mapping, страница 2

                        | ‘ENTITIES’

                        | ‘NMTOKEN’

                        | ‘NMTOKENS’

enumeratedtype = notationtype | enumeration

            defaultdec =      '#FIXED' value

                                    | '#REQUIRED'

                                    | '#IMPLIED'

Rose mapping

A DTD ATTList Maps to Rose attributes.  Atttypes map to Rose attribute types.  An attribute default declaration (#FIXED, #REQUIRED or #IMPLIED) is modeled using the tagged property “Default Value” and the value is modeled as the attribute’s Initial Value. 



ALIGN             (top | middle | bottom)  #IMPLIED>

            ATL                 CDATA                        #FIXED “POST”

<!ATTLIST list

            type (bullets|ordered|glossary) "ordered">

DTD Entity

Entities can be used for the following purposes:

·  The definitions of abbreviated notations to ease repetitive text strings

·  The definition of notations to input special characters, accents or symbols

·  The inclusion of external files

·  The definition of variables in a DTD

An entity declaration first specifies a symbolic name for the entity, followed by its contents.  The latter can contain tags or entity references, which will be interpreted when the entity is expanded.  To refer to an entity one makes use of an entity reference, which takes the form of:


DTD semantics

            <!ENTITY NAME EntityDef >

            <!ENTITY '% '  NAME PEDef >

            EntityDef  =     LITERAL

                                    | extid NDataDecl

            PEDef =          LITERAL

                                    | extid

            extid =              'SYSTEM' sysid

                                    | 'PUBLIC' pubid sysid

            sysid =              LITERAL

            pubid =             LITERAL

NdataDecl =     NDATA  NAME

Rose mapping

A DTD Entity maps to a Rose class with the stereotype of DTDEntity. 

Internal Entity

If the entity definition takes the formart <!ENTITY NAME LITERAL >, the defined entity is called as internal entity. An internal entity is mapped to a <<DTDEntity>> class with tagged property of Internal Value, For example:

<!ENTITY TUG "\TeX{} Users Group">

Value = \ TeX{} Users Group

Predefined Entity

The entities used to define notations to input special characters, accents or symbols, such as:

<!ENTITY lt     "&#38;#60;">

The mapping of a predefined entity is the same as that of internal entity.

External Entity

If the entity is not internal, it is an external entity.  The system and public literals are modeled with tagged properties System ID and Public ID.

<!ENTITY ent2 SYSTEM "http:/">

<!ENTITY logo.gif SYSTEM "" NDATA gif>

<!NOTATION gif SYSTEM "CompuServe Graphics Interchange Format 87a">

System ID = http:/

System ID =

<!ENTITY open-hatch

PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"

Parameter Entity:

<!ENTITY % ednote.class         "">

<!ENTITY %tech.pck.mix        "#PCDATA | %ednote.class;">

<!ELEMENT code (%tech.pck.mix;)*>

<!ENTITY % common.att

            'id         ID                    #IMPLIED

role      NMTOKEN      #IMPLIED' >

Value = id  ID  #IMPLIED    role NMTOKEN  #IMPLIED

DTD Notation

Notations is used when non-XML content – like graphics, sound, video or source-code listing -- is need to be included in the XML documents.  While the XML parser knows nothing about specific notations, it can pass them on to the processing software to let it know what kinds of data to handle.  Every non-XML datatype in a document should be declared as a notation.

DTD semantics

            <!NOTATION NAME extid >

            (see extid under DTD Entity)

Rose mapping

A DTD Notation maps to a Rose class with the stereotype of <<DTDNotation>>.  extid  is modeled as tagged properties as that in DTD Entity. 



            "+//ISBN 0-201-13448-9::Knuth//NOTATION The TeXbook//EN">

Public ID = +//ISBN 0-201-13448-9::Knuth//NOTATION The TeXbook//EN