XML To Java

XML to Java is a synchronous activity. You can use this activity to create an instance of a Java object based on data from an XML document. The XML schema for providing the input to the Java object or Java schema specified on the General tab of this activity.

General

The specified Java class must meet the following requirements:

  • The Java class must have a public default constructor (that is, a constructor with no arguments).
  • The Java class must be eligible to be serialized (that is, the class must implement or be a subclass of a class that implements java.io.Serializable).
Note: If the class does not have a public data member and only has a Java bean accessor that retrieves the data, the input schema contains an element for the accessor. However, the resulting Java object has no value set for the member. For example, the object has a method declared as public int getID(), but there is no method for setting the ID and the data member ID is not public. In this case, an element named ID in this activity’s input schema, but mapping a value to the element does not result in setting the ID member of the output Java object. This is because there is no public mechanism for setting the data.

The General tab has the following fields.

Field Module Property? Description
Name No The name to be displayed as the label for the resource.
Class Name No The class name in the Java schema to use.

Use the Browse button to bring up the dialog to select the Java class.

Description

Provide a short description of the activity.

Input

The following is the input for the activity.

Input Item Datatype Description
XML Schema varies The XML schema you want to convert to a Java object. The content of this schema depends upon the Java class or Java schema defined in the Class Name field on the General tab.

The elements in the schema display in an alphabetical order.

Output

The following is the output of the activity.

Output Item Datatype Description
referenced class Java Object A Java object that is created out of the XML schema.

Fault

The Fault tab lists the possible exceptions thrown by this activity. See Error Codes for more information about error codes and the possible corrective actions.

Fault Thrown When..
XMLToJavaConversionException An error occurred when converting the XML schema to a Java object.