Code Block |
---|
|
set myAddress = addressASXMLDocument.xmlToClass(); |
The following action script creates an object of type Address. An output object node named myAddress of type Address needs to be defined in the activity diagram.
Code Block |
---|
|
create myAddress;
set myAddress = addressASXMLDocument.xmlToClass(); |
Below, a sample XML document is shown to illustrate the mapping executed by xmlToClass() operation. The XML document is mapped to an instance of Address as depicted in the class diagram:
Code Block |
---|
|
<myAddress id="myAddressID">
<street>Lautengartenstr. 12</street>
<city>Basel</city>
</myAddress> |
| Image Modified |
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.