Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/MOXy/Dynamic/XmlToDynamicEntity"

< EclipseLink‎ | Examples‎ | MOXy‎ | Dynamic
(Overview)
(Unmarshal DynamicEntities from XML)
Line 3: Line 3:
  
 
==Unmarshal DynamicEntities from XML==
 
==Unmarshal DynamicEntities from XML==
 +
The Unmarshaller obtained from the DynamicJAXBContext is a standard unmarshaller, and can be used normally to unmarshal instances of DynamicEntity.
 
<source lang="java">
 
<source lang="java">
 
FileInputStream xmlInputStream = new FileInputStream("src/example/dynamic/customer.xml");
 
FileInputStream xmlInputStream = new FileInputStream("src/example/dynamic/customer.xml");

Revision as of 11:14, 24 June 2010

Overview

In this example you will learn how to unmarshal dynamic entities from XML.

Unmarshal DynamicEntities from XML

The Unmarshaller obtained from the DynamicJAXBContext is a standard unmarshaller, and can be used normally to unmarshal instances of DynamicEntity.

FileInputStream xmlInputStream = new FileInputStream("src/example/dynamic/customer.xml");
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
DynamicEntity customer = (DynamicEntity) unmarshaller.unmarshal(xmlInputStream);