Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Mastering UML with Rational Rose 2002.pdf
Скачиваний:
137
Добавлен:
02.05.2014
Размер:
9.68 Mб
Скачать

Chapter 16: XML DTD Code Generation and Reverse Engineering

Here is the DTD generated for the classes shown above.

<!ENTITY MyVideo SYSTEM "C:\Videos\Vacation.vid" NDATA Video> <!NOTATION Video SYSTEM "C:\MyVideoPlayer.exe">

Note As long as the relationship exists, it does not matter what you enter in the Notation Name field on the entity specification window. If, for example, entity A is connected to notation N1 with an association relationship, and the Notation Name field on entity A's specification window refers to notation N2, notation N1 will still be used to generate the DTD.

To create a notation:

1.

Create a new class.

2.

Assign the stereotype <<DTDNotation>> to the class.

3.

Use the specification window to set the notation details as described above.

Rose 2001A and 2002 provide an icon that can be used for notations. The Notation icon looks like this:

Attributes

An element's attributes are modeled as attributes within the element class. Each attribute has a data type and optional default value. These can be set using the Field Specification window, as shown in Figure 16.17.

562

Chapter 16: XML DTD Code Generation and Reverse Engineering

Figure 16.17: DTD Field Specification window

The Type property is used to document the data type of the attribute. There are several options for the Type property, including:

CDATA, which means that the attribute is simple character data

ENTITIES, which means that the attribute is a group of entities

ENTITY, which means that the attribute is another entity

ID, which means that the attribute is an element identifier

IDREF, which means that the attribute is a reference to the ID of another element

IDREFS, which means that the attribute is a group of IDREFs

NMTOKEN, which means that the attribute is a name token attribute, which is a single word

NMTOKENS, which means that the attribute is a collection of NMTOKENs

563