Download code engineering sets

Transcript
5
MagicDraw Code and Database Engineering
XML Schema
<xs:element name="person">
<xs:complexType>
<xs:sequence>
. . .
<xs:element name="car">
<xs:complexType>
<xs:attribute name="regState" type="twoLetterCode"/>
<xs:attribute name="regPlate" type="xs:integer"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
A state element is defined, which contains a code child and some vehicle and person
children. A vehicle in turn has a plateNumber attribute, which is an integer, and a state
attribute. State's codes are a key for them within the document. Vehicle's plateNumbers are a
key for them within states, and state and plateNumber is asserted to be a key for vehicle
within the document as a whole. Furthermore, a person element has an empty car child, with
regState and regPlate attributes, which are then asserted together to refer to vehicles
via the carRef constraint. The requirement that a vehicle's state match its containing
state's code is not expressed here.
selector and field UML Model example
For an example, see Section “keyref UML Model example” on page 5-122
annotation
Maps to UML Comment with or without stereotype XSDannotation.
Documentation’s content maps to UML Comment body(name).
“documentation” maps as UML comment:
•
“content” value shall be comment name
•
“xml:lang” value – tag “xml:lang” value
•
source value – tag ”source” value
“appinfo” maps as tag value with name “appInfoSource”:
•
“source” value will be tag value
•
“content” will be documentation for tagged value
Appearing several annotation nodes on one element node, mapping shall be done in following
way:
•
5-126
“documentation” text shall be merged into one UML comment with
merged content, but “content” and “xml:lang” tag values shall represent
only first matched values
© 2003 No Magic, Inc.