Page History
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
|
Mapping of UML classes to XML documents is controlled by stereotypes assigned to class attributes and association ends. Tagged value Class To XML Default Root Name on the composite controls the name that will be assigned to the root element (see Frontend Components).
...
Stereotype | Description | Tagged Values (Description see below) | |
---|---|---|---|
<<XML>> | Set this basic stereotype on class level to be able to apply the stereotypes listed below to the attributes. | xmlNamespace xmlElementName isMixed isOrdered | |
<<XMLElement>> | UML properties are mapped to XML elements. | xmlNamespace xmlForm xmlFormat isNillable | |
<<XMLAttribute>> | UML properties having a simple type are mapped to XML attributes. | xmlNamespace xmlForm xmlFormat | |
<<E2EAttribute>> | This stereotype can be used to specify an order for the generation of XML elements. | order | |
<<XMLNamespace>> | UML properties having a simple type are mapped to XML namespaces. The prefix of the namespace is given by the property name. If the same namespace is declared more than once, the runtime will suppress namespaces further down the XML hierarchy, if prefix and namespace are identical. If not, the xUML Runtime will throw an exception. | ||
<<XMLCharacters>> | UML properties having a simple type are serialized as a character stream. | xmlFormat |
...
Tagged Value | Level | Description | Allowed Values | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
classToXMLDefaultRootName | Composite |
| Default |
| |||||||||||||||||
Type Name |
| ||||||||||||||||||||
Variable Name |
| ||||||||||||||||||||
xmlNamespace | Class | Specify the XML namespace. | a valid namespace | ||||||||||||||||||
xmlElementName | Class | Specify the name of the XML root element. | a valid element name | ||||||||||||||||||
isMixed | Class | Specify whether the XML contains mixed (static and variable) content. For more information on mixed content, refer to Mixed Content. | true | XML contains mixed content. | |||||||||||||||||
false | XML does not contain mixed content (default). | ||||||||||||||||||||
isOrdered | Class | Specify whether the class attributes should be serialized to XML using the order tag that has been specified on the attributes. | true | Serialize in order of order tags from the attributes. | |||||||||||||||||
false | Serialize in order of attributes on class. | ||||||||||||||||||||
xmlNamespace | Attribute | Each XML attribute and element may have its own namespace. If the tagged value contains an URI, the runtime will automatically generate a unique prefix. For example: A tagged value xmlNamespace = "http://e2e.ch" on the UML property anElement will result in the XML document<ns0:anElement xmlns:ns0="http://e2e.ch"> .However, it is possible to define the prefix by using the following syntax: 'xmlns:' <prefix name> '=' <namespace uri> . For example, the tagged value xmlNamespace = 'xmlns:typens="http://e2e.ch"' of the UML property anElement will lead to the following XML fragment: <typens:anElement xmlns:typens="http://e2e.ch"> . | an URI | ||||||||||||||||||
a valid xlmns syntax | |||||||||||||||||||||
xmlForm | Attribute | Depending on this tagged value, XML elements or attributes may not be qualified by a namespace prefix even if they have one. | qualified | The element or attribute must always be qualified by a namespace prefix. Default for XML elements. | |||||||||||||||||
unqualified | No namespace prefixes are allowed (for details see http://www.w3.org/TR/xmlschema-0/#NS). Default for XML attributes. | ||||||||||||||||||||
xmlFormat | Attribute | If numbers and date/time types are parsed or composed, the XML parser respectively composer expects simple date types following the XML schema specification. However, legacy XML documents may contain different number and date/time formats. In this case, the tagged value xmlFormat may hold a format string. If numbers are parsed or composed use the format strings defined in section Number Formatting. If date/time expressions must be parsed or composed, use the format strings defined in Date and Time Formatting. Use xmlFormat = "CDATA" together with stereotype <<XMLElement>> to compose strings as CDATA with classToXML() . Parse CDATA elements works out of the box, you do not need to set xmlFormat. | a valid format string (see Number Formatting or Date and Time Formatting) | ||||||||||||||||||
CDATA | compose string as CDATA | ||||||||||||||||||||
isNillable | Attribute | By default, UML properties that are NULL are not serialized into XML documents. However, if it is necessary to do so, isNillable must be set to true. In this case, the UML properties being NULL will look like:
| true | serialize NULL properties | |||||||||||||||||
false (default) | do not serialize NULL properties | ||||||||||||||||||||
order | Attribute | Use this tagged value of <<E2EAttribute>> to specify the order in which the XML elements will be generated to the XML document. | a valid float |
...
With the three XML stereotypes, one has the flexibility to map XML structures in different ways. You can define very compact class diagrams for simple XML structures, but you have also the possibility to map complex XML data structures graphically.
Noteinfo | ||
---|---|---|
| ||
If an XML Schema is provided, you can import it with the Builder. It will generate all classes and relations according the XSD import rules described in XML Schema Import Rules. For how to use the E2E XSD Importer refer to Importing WSDL or XSD. |