|
Syntax |
|
||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Semantics |
The operation takes any object ( By default the following mapping rules apply:
These default rules can be overridden by using <<XMLElement>>, <<XMLAttribute>> and <<XMLCharacters>> stereotypes on UML class attributes and UML association ends.
The WSDL/XSD importer will not set these XML stereotypes, hence A conversion with operation |
||||||||||||||||||||||||||||
|
Substitutables |
|
Target object can be any complex object. However, simple types and arrays are not supported, since they do not map naturally to a well formed XML document. |
|||||||||||||||||||||||||||
|
|
This optional parameter is an object of type XMLComposeOptions.
Its attributes are:
|
||||||||||||||||||||||||||||
|
Examples |
|
||||||||||||||||||||||||||||
Example File (Builder project E2E Action Language/XML): XML.zip
<your example path>\E2E Action Language\XML\uml\xmlSimpleConversions.xml
<your example path>\E2E Action Language\XML\uml\xmlComplexConversions.xml
The following action script serializes an object of type Address provided, that you have defined an input object node named myAddress of type Address in the activity diagram.
set xmlBlob = myAddress.classToXML();
The sample XML document below illustrates the mapping executed by classToXML(). The object myAddress of type Address (see class diagram) is mapped to an XML document as depicted in the following XML document:
<myAddress id="myAddressID">
<street>Lautengartenstr. 12</street>
<city>Basel</city>
</myAddress>
Note, that the XML element myAddress is of type Address. This type has the UML attribute id, which corresponds to the XML attribute id. Additionally, the XML elements street and city are mapped to the association ends city respectively street. Both are having the type String.
By default the following mapping rules apply:
-
Class attributes are mapped to XML attributes.
-
Association ends are mapped to XML elements.
These default rules can be overridden by using <<XMLElement>>, <<XMLAttribute>> and <<XMLCharacters>> stereotypes on UML class attributes and UML association ends.
More about these mapping rules, stereotypes and tagged values (e.g. for number and date & time formatting) can be found at XML - UML Class Mapping.
Builder 7.5.0 Additionally, you can hide attributes from being serialized by applying stereotype <<E2EPrivate>>. Refer to AttributeSpecification > Hiding Attributes From Interfaces for more information.
This optional parameter is an object of type XMLComposeOptions.
Its attributes are:
|
Attribute |
Type |
Description |
Example |
|---|---|---|---|
|
prolog |
Array of String |
The string values are inserted right before the root element of the generated document. This mechanism can be used to insert processing instructions (e.g. DTD and Schema references), comments, entities or any other prolog you may think of. However, be aware that using prolog arrays makes it easy to generate non-well-formed documents. |
|
|
timezone |
String |
Time zone string as specified in the Date and Time Formatting. The timezone is used to print dateTime expressions. If no timezone is given, UTC is used.
|
|
|
dateFormatString |
String |
A format string to be used when printing DateTime values as |
|
|
encoding |
String |
Encoding of the target xml. Default encoding is UTF-8.
|
|
|
rootName |
String |
Name of the generated XML root element. Use this tagged value to override the default behavior specified on the composite (see Frontend Components). |
|
|
rootNamespace |
String |
Name of the namespace of the generated XML root element. |
|