Search in sources :

Example 1 with CreatureSet

use of objects.CreatureSet in project ultimate-java by pantinor.

the class TestJaxb method testCreatures.

// @Test
public void testCreatures() throws Exception {
    File file = new File("target/classes/xml/creatures.xml");
    JAXBContext jaxbContext = JAXBContext.newInstance(CreatureSet.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
    CreatureSet ts = (CreatureSet) jaxbUnmarshaller.unmarshal(file);
    for (Creature t : ts.getCreatures()) {
        System.out.println(t);
    }
}
Also used : CreatureSet(objects.CreatureSet) Creature(objects.Creature) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller) File(java.io.File)

Aggregations

File (java.io.File)1 JAXBContext (javax.xml.bind.JAXBContext)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 Creature (objects.Creature)1 CreatureSet (objects.CreatureSet)1