The EMF XMLToSDO Function Component converts an XML document to SDO objects connected in a tree-like structure resembling the XML structure.
The XMLToSDO Function Component is deprecated in the IBM TDI 7.1 release and will be removed in a future version.
For each XML element an XML Attribute Data Object is created. TDI Entry Attributes are then created for some of the Data Objects. The name of the Entry Attribute consists of the names of the ancestor elements of the element the TDI Attribute represents. Subsequent XML element names are separated by the "@" character. When an XML attribute is represented, the name of the XML attribute is appended to the name of the XML element using the "#" symbol as a separator.
All Attribute names start with the "DocRoot" text which represents the XML root. There are two types of Entry Attribute values:
XML elements that have a common parent element are called siblings. Sibling elements with the same name are grouped in a multi-valued TDI Attribute Entry.
Attributes are not created for XML elements with an ancestor element that has a sibling with the same name. Those can only be accessed through the multi-valued Attribute representing the siblings.
This example illustrates how the following XML file is processed by the EMF XMLToSDO Function Component:
<?xml version="1.0"> <database name="Persons"> <description>This is a sample database</description> <person> <name>Ivan</name> <age>21</age> </person> <person> <name>George</name> <age>32</age> </person> </database>
When the EMF XMLToSDO Function Component processes the example XML File, an entry with the following Attributes is created:
"DocRoot@database@person@name" is not a valid TDI Attribute in this case because more than one person XML element exists in the XML document at the same level.
The EMF XMLToSDO Function Component provides an option to use namespace prefixing. Namespace prefixing option specifies that all XML element names part of the Entry Attribute name will be prefixed with the corresponding namespace; for example: "DocRoot@namespace1:database@namespace2:person".
The extension of the XML Schema File specified must be ".xsd".
This parameter also specifies whether the Discover Schema functionality will use XML namespaces to prefix the Entry Attribute names.
This parameter is only taken into account if the "useNamespaces" parameter is set to true.
The EMF XMLToSDO and SDOToXML Function Components are not compatible with the TDI 6.0 Castor Function Components. Any solution which uses the Castor Function Components needs to be re-implemented in order to work with the EMF XMLToSDO and EMF SDOToXML Function Components. The Castor XML To Java Function Component supports a mapping file. This mapping file can be used to specify how a complex custom XML is to be parsed and converted to a complex custom Java object. This feature is not supported by the EMF XMLToSDO Function Component. By following the next broad guidelines, a TDI 6.0 configuration can be re-implemented to work with the EMF XMLToSDO Function Component:
The Castor XML To Java Function Component used to support a mechanism which allowed a specific portion of the XML to be mapped to Entry Attributes. The EMF XMLToSDO Function Component does not support this feature. The EMF XMLToSDO Function Component always parses and maps the entire XML to Entry Attribute. By using the Input Attribute Map of the EMF XMLToSDO Function Component, however, only the desired Attributes can be mapped thus emulating the behavior of the Castor XML To Java Function Component.
The Castor Java To XML Function Component used to support a mapping file, which could be used to specify how to serialize a complex Java object into XML (element/attribute names, etc.). The EMF SDOToXML Function Component serializes into XML based on an XML Schema file, that is, the names of elements/attributes, etc. are specified in the XML Schema file specified as a Function Component parameter.