The CastorXMLtoJava Function Component is the mirror-image counterpart to the Castor Java to XML Function Component, and the same section on Castor Overview applies.
Specifically, the CastorXMLtoJava FC creates an Entry or
a general Java object from an XML document, and it provides the option
to get data from certain parts of the XML tree when deserializing
the XML document.
In addition to the Castor mapping mechanism which specifies how
to build a Java object (possibly of a custom Java class) from an XML
node/subtree, this Function Component provides its own logic to specify
how to populate Entry Attributes from an XML document. By using XPath
queries we can specify which parts of the XML document will be passed
to the Castor APIs for deserializing.
This approach both provides ease of use in the IBM TDI context and
gives more power when processing custom XML documents, for example
XML documents generated by other systems. Through the XPath queries
you are able to specify which parts of the XML you are interested
in (and get them directly into Entry Attributes) and which are irrelevant
for your process and should not be processed. In addition, the writing
of the Castor XML Mapping Files is facilitated since we will only
have to write mapping rules for the parts of the XML document you
are interested in and not for the whole XML document.
The CastorXMLToJava 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 CastorXMLToJava Function Component creates an Entry or
a general Java object from an XML document, and 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 the Function Component is passed an object that is not an
Entry on input (String or a DOMelement) it returns
the raw Java object as it is unmarshalled by Castor. This mode of
operation is called non-Entry mode.
Configuration
Parameters
Using the FC
Entry mode
Non-Entry mode