classToXMLFragment() Operation
Syntax |
| |
---|---|---|
Semantics | The operation takes any object ( By default the following mapping rules apply:
These default rules can be overridden by using the stereotypes XMLElement, XMLAttribute, and XMLCharacters on class properties. 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. |
|
Please find a detailed description of the properties below. | |
Examples |
NONE
|
XMLComposeOptions
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 on Time Zones. 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. |
|
rootnamespace | String | Name of the namespace of the generated XML root element. |
XML Serialization Example
Assume you have an object myAddress of type Address:
The following action script serializes this object:
set xmlBlob = myAddress.classToXMLFragment();
The sample XML fragment below illustrates the mapping executed by classToXMLFragment()
. The object myAddress of type Address (see class diagram) is mapped the depicted XML fragment:
<name>ACME Corp.</name>
<street>108, Kearny Avenue</street>
<town>Newark</town>