Processing complex and custom data types is often a requirement for various XML solutions, for example Web Services.
The existence of a self-contained Java-to-XML and XML-to-Java binding functionality in the IBM TDI provides the ability to process complex/custom data types independently of a Web Service toolkit. In particular this means that there is an option to deal with possible binding limitations of various Web Service toolkits.
Castor is an open source data binding framework providing access to the data defined in an XML document through an object data model.
Castor can marshal almost any "bean-like" Java object to and from XML. The process of marshalling/unmarshalling can use Castor's default introspection model (an implementation based on Java reflection where Castor decides how to marshal and unmarshal data), but this process can also be controlled and customized by the use of Castor XML Mapping Files that define mapping rules.
From an IBM TDI perspective, you can create XML Mapping Files and specify how custom data is mapped to and from XML.
With Castor you can process an XML document not specially designed for Castor by skipping parts of the XML you are not interested in. A limitation here is that Castor cannot skip an XML node and process a node belonging to the subtree of the skipped node. This limitation is a serious inconvenience when you want to extract random parts of a big and complex XML document (cases which might be expected in the real world) - that is why the IBM TDI Castor Function Components provide the ability to specify certain parts of the XML through XPath queries.
The CastorJavaToXML Function Component uses Castor 0.9.5.4. Documentation and information for the Castor library can be obtained from the Castor project web site: http://www.castor.org/
The mapping file as specified by this parameter should always include the mapping rules defined in the TDI_install_dir/etc/di_castor_mapping.xml file. This means that either specify "etc/di_castor_mapping.xml" as value of this parameter or make sure that the mapping file specified contains these rules (for example by using Castor's "include" clause to include "di_castor_mapping.xml" rules in another mapping file).
The CastorJavaToXML Function Component creates an XML document from a Java object or an Entry object.
This Function Component can operate both with Entry objects and with custom Java objects.
When the Function Component is passed an Entry object on input, it will return an Entry object. This mode of operation is called Entry mode.
When passed a Java object which is not an Entry object, the Function Component will serialize the object passed using Castor serialization and this will be the result XML. This mode of operation is called non-Entry mode.