Tivoli Directory Integrator, Version 7.0

Castor Java to XML Function Component

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 Tivoli Directory Integrator 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 Overview

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® Tivoli® Directory Integrator 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 Tivoli Directory Integrator 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/

Configuration

Parameters

Castor Mapping File
An XML Mapping File (as defined by the Castor syntax) that defines how Java or Entry objects are serialized into XML.

The mapping file as specified by this parameter should always include the mapping rules defined in the TDI_install_dir/jars/functions/di_castor_mapping.xml file. This means that either you must specify "jars/functions/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).

XML Root Element
The name of the root element of the generated XML; if left empty the root element is named "Entry".
Use Attribute Names
If this is checked, the names of the Attributes are used as XML element names, otherwise the XML elements are named as specified in the Mapping File. This parameter is only taken into account in Entry mode.
Return XML as
This drop-down list specifies the return type - only taken into account when the input object is not an object of type Entry. Valid values are String and DOMelement.
Detailed Log
Check to generate additional log messages.
Comment
Your own comments go here.

Using the FC

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.

Entry mode

Non-Entry mode

[ Top of Page | Previous Page | Next Page | Contents | Terms of use | Feedback ]
(C) Copyright IBM Corporation, 2003, 2009. All Rights Reserved.
IBM Tivoli Directory Integrator 7.0