JAXB Wizard and Code-Seeder Palette User's Guide

Unmarshal JAXB Object

The Unmarshal palette icon action will generate template code to unmarshal a JAXB object. This allows for any global XML element declared in the schema to be unmarshalled as the root of an instance document. The JAXBContext object allows the merging of global elements across a set of schemas (listed in the contextPath). This means that a client application is able to unmarshal XML documents that are instances of any of the schemas listed in the contextPath. You must know the Class name of the object you are trying to unmarshal. Since each schema in the schema set can belong to distinct namespaces, the unification of schemas to an unmarshalling context should be namespace-independent. You can search for the class using the Find button. The template code can be generated to unmarshal a JAXB object from a String, InputStream, File, Reader, or byte array.


Note –

The Code-Seeder currently generates code using a single package name in the context path. You may want to edit the code if more than one package name is needed in the context path.


ProcedureTo Generate Code Using the Unmarshal JAXB Object

  1. To unmarshal an existing JAXB class object, drag and drop the JAXB Unmarshal palette icon into the IDE editor.

    The Generate JAXB Unmarshal code dialog box is displayed.

    Figure 10 Unmarshal Option

    Marshal To

  2. Enter the JAXB object's class name or use the Find... button to search for the class. (as in the Construct's Figure 3section)

  3. Select the Unmarshal From option. You can generate the code to unmarshal a JAXB object from one of String, Reader, InputStream, JMSTextMessage, or File.

    Figure 11 Select Unmarshal From

    Unmarshal From

    The Unmarshal Method will be generated as shown below.

    Figure 12 Unmarshal Method

    Unmarshal Method