Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WBRIDGE and version 7.6.0

...

Tagged ValueLevelDescriptionAllowed Values
classToXMLDefaultRootNameComposite

Multiexcerpt include
MultiExcerptNameclassToXMLDefaultRootName
PageWithExcerptFrontend Components

Note
iconfalse

If this tagged value is set to other values than "Default", tagged values xmlElementName and xmlNamespace on the <<XML>> class are disregarded.


Default

Multiexcerpt include
MultiExcerptNamerootName_Default
PageWithExcerptFrontend Components

Type Name

Multiexcerpt include
MultiExcerptNamerootName_Type
PageWithExcerptFrontend Components

Variable Name

Multiexcerpt include
MultiExcerptNamerootName_Variable
PageWithExcerptFrontend Components

xmlNamespaceClassSpecify the XML namespace.a valid namespace
xmlElementNameClassSpecify the name of the XML root element.a valid element name
isMixedClass

Specify whether the XML contains

mixed (static and variable) content.

attributes that are serialized as character stream (attributes with stereotype <<XMLCharacters>>, see also Controlling the Mapping by Stereotypes).
For more information on mixed content, refer to Mixed Content.

trueXML contains mixed contentserialized attributes.
falseXML does not contain mixed content contain serialized attributes (default).
isOrderedClassSpecify whether the class attributes should be serialized to XML using the order tag that has been specified on the attributes.trueSerialize in order of order tags from the attributes.
falseSerialize in order of attributes on class.
xmlNamespaceAttribute

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

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
xmlFormAttribute

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.

unqualifiedNo namespace prefixes are allowed (for details see http://www.w3.org/TR/xmlschema-0/#NS). Default for XML attributes.
xmlFormatAttribute

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)
CDATAcompose string as CDATA
isNillableAttribute

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: <aProperty xsi:nil="true"></aProperty>.

Info
iconfalse

Some client code generators will use this attribute in the WSDL file for type generation. If false they will generate simple types, if true they will generate complex types.

trueserialize NULL properties
false (default)do not serialize NULL properties
orderAttributeUse this tagged value of <<E2EAttribute>> to specify the order in which the XML elements will be generated to the XML document.a valid float

...

The following table shows the behavior of XML serialization for the examplefollowing class containing an array:

Code Block
{
	"aClass" : { "anArray" : ["A1", "A2", "A3"] };
}
DescriptionXML result
All values are present.
Code Block
languagexml
<aClass>
    <anArray>A1</anArray>
    <anArray>A2</anArray>
    <anArray>A3</anArray>
</aClass>
The second value (A2) is NULL and isNillable=false.
Code Block
languagexml
<aClass>
    <anArray>A1</anArray>
    <anArray>A3</anArray>
</aClass>
The second value (A2) is NULL and isNillable=true
Code Block
languagexml
<aClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <anArray>A1</anArray>
    <anArray xsi:nil="true"/>
    <anArray>A3</anArray>
</aClass>
The array is NULL.
Code Block
languagexml
<aClass>
</aClass>
The array is empty.
Code Block
languagexml
<aClass>
</aClass>
All elements are NULL and isNillable=false.
Code Block
languagexml
<aClass>
</aClass>
All elements are NULL and isNillable=true.
Code Block
languagexml
<aClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <anArray xsi:nil="true"/>
    <anArray xsi:nil="true"/>
    <anArray xsi:nil="true"/>
</aClass>
classToXMLDefaultRootName="Default" and xmlElementName="anotherClass".
Code Block
languagexml
<anotherClass>
    <anArray>A1</anArray>
	<anArray>A2</anArray>
	<anArray>A3</anArray>
</anotherClass>
classToXMLDefaultRootName="Type Name" and xmlElementName="anotherClass".
Code Block
languagexml
<AClassType>
    <anArray>A1</anArray>
	<anArray>A2</anArray>
	<anArray>A3</anArray>
</AClassType>
classToXMLDefaultRootName="Variable Name" and xmlElementName="anotherClass".
Code Block
languagexml
<aClass>
    <anArray>A1</anArray>
    <anArray>A2</anArray>
    <anArray>A3</anArray>
</aClass>

Examples

Multiexcerpt include
MultiExcerptNameurlUrl
nopaneltrue
PageWithExcerptINTERNAL:_examples_BRIDGE

The following example shows how to convert Suppose an XML data structure contains elements with attribute values (in the example below these are street and city ), and you want to convert them to with mixed content to an UML class.

Info
iconfalse

If an XML element has attributes, this is called mixed content in Bridge context.

Suppose the following XML data structure with two elements street and city is given:

Code Block
html/xml
html/xml
<address id="myAddress4711">
	<street id="234">Lautengartenstr. 12<4711-1">13, Coal Street</street>
	<city id="34">Basel<4711-2">New York, NY 10017, USA</city>
</address>

The class diagram below illustrates how to map the content of the XML element street ("Lautengartenstr. 1213, Coal Street") and the value of its attribute id ("2344711-1") to the UML association end street:

Figure: Mapping XML Data Structures to UML Classes

Image Removed

a class structure:

Image Added

To map XML element street and its attribute id, you need a dedicated class as a container. In this example, this is class StreetElement. XML attribute id of The street element from the above XML example is mapped to the association end street. The association end name must be the same as the name of the XML element. The associated class StreetElement is only a container for the street element. The name of the class is not relevant for the mapping. The XML attribute id of the element street is mapped to the class attribute id of the UML class StreetElement via matching names. The content of the XML element street is mapped to the class attribute text_value, which has the stereotype <<XMLCharacters>>that has stereotype <<XMLCharacters>>. In this example this is text_value.
Class StreetElement must have stereotype <<XML>> and tagged value isMixed set to true because it contains the serialized attribute text_value (also see explanation of tagged value isMixed).

Containter StreetElement is associated to the main address class. The name of the association end (street) must match the name of the XML element. Associated class StreetElement is only a container for the street element and its name is not relevant for the mapping.

If the XML element contains attributes, which should not be mapped to UML class attributes, an association to a base type can be used. The following example shows this for the element city. The content of the element ("BaselNew York, NY 10017, USA") will be available in city (accessible as attribute of the instantiated class Address2Example1). As the id attribute cannot be mapped, it will be discarded when executing the operation xmlToClass().

Figure: Preventing the Mapping of XML Attributes

Image Removed

Below, find the complete class diagram used for mapping the XML document address.xml.

Figure: Example when Using Operation xmlToClass()

...

If an object of class Address2Example1 were was serialized back in a SOAP response, the SOAP message would read:

Code Block
html/xml
html/xml
<address2Example1 xmlns:ns1="urn:Services.URLService.URLPort.DataItems" xsi:type="ns1:Address2Example1">
    <id xsi:type="xsd:string">34<>4711</id>
    <street xsi:type="ns1:StreetElement">
      	<id xsi:type="xsd:string">234<>4711-1</id>
      	<text_value xsi:type="xsd:string">Lautengartenstr. 12
     	<>13, Coal Street</text_value>
    </street>
    <city xsi:type="xsd:string">Basel<>New York, NY 10017, USA</city>
</address2Example1>

The same result could be obtained with the following class diagram.

...

:

...

Image Removed Image Added

With the three XML stereotypes, one has the You have 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.

Info
iconfalse

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.