Package org.exolab.castor.xml

Examples of org.exolab.castor.xml.Unmarshaller.unmarshal()


        unm = new Unmarshaller(Harness.class);
        mapping = new Mapping();
        mapping.loadMapping(Main.class.getResource("harness/mapping.xml"));
        unm.setMapping(mapping);
        if (_testRes != null) {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    Main.class.getResourceAsStream(_testRes)));
        } else if (_testFile != null) {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    new FileInputStream(_testFile)));
        } else if (_testUrl != null) {
View Full Code Here


        unm.setMapping(mapping);
        if (_testRes != null) {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    Main.class.getResourceAsStream(_testRes)));
        } else if (_testFile != null) {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    new FileInputStream(_testFile)));
        } else if (_testUrl != null) {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    (new URL(_testUrl)).openStream()));
        } else {
View Full Code Here

                    Main.class.getResourceAsStream(_testRes)));
        } else if (_testFile != null) {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    new FileInputStream(_testFile)));
        } else if (_testUrl != null) {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    (new URL(_testUrl)).openStream()));
        } else {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    Main.class.getResourceAsStream(DEFAULT_FILE)));
        }
View Full Code Here

                    new FileInputStream(_testFile)));
        } else if (_testUrl != null) {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    (new URL(_testUrl)).openStream()));
        } else {
            harness = (Harness) unm.unmarshal(new InputStreamReader(
                    Main.class.getResourceAsStream(DEFAULT_FILE)));
        }
        testApp = harness.createTestHarness(_testBranchs);
        return testApp;
    }
View Full Code Here

    mapping.loadMapping("mapping.xml");

    Unmarshaller unmarshaller = new Unmarshaller(mapping);
    unmarshaller.setClassLoader(Item.class.getClassLoader());
    unmarshaller.setValidation(false);
    Item item = (Item) unmarshaller.unmarshal(new InputSource(new java.io.FileInputStream(args[0])));

    System.out.println("description     =" + item.description);
    System.out.println("mediaDescription=" + item.mediaDescription);
  }
}
View Full Code Here

    public void testMarshallingAfterManuallyNullingID() throws Exception {
       
        Unmarshaller unmarshaller = new Unmarshaller (PartialTerminationElement.class);
       
        PartialTerminationElement entity = (PartialTerminationElement)
           unmarshaller.unmarshal(new InputSource(this.getClass().getResource("input-ok.xml").toExternalForm()));
        // assertNotNull (entity);
       
        entity.getPartyOneElement().setId("");
       
        StringWriter out = new StringWriter();
View Full Code Here

     */
    public void testMarshallingAfterManuallySettingDuplicateID() throws Exception {
        Unmarshaller unmarshaller = new Unmarshaller (PartialTerminationElement.class);
       
        PartialTerminationElement entity = (PartialTerminationElement)
           unmarshaller.unmarshal(new InputSource(getClass().getResource("input-ok.xml").toExternalForm()));
        // assertNotNull (entity);
       
        entity.getPartyOneElement().setId("ID000001");
       
        StringWriter out = new StringWriter();
View Full Code Here

    public void testUnmarshalEntity() throws Exception {

        Unmarshaller unmarshaller = getXMLContext().createUnmarshaller();
        unmarshaller.setClass(Entity.class);
       
        Entity entity = (Entity) unmarshaller.unmarshal(new InputSource(getClass().getResource(SAMPLE_FILE).toExternalForm()));
        assertNotNull (entity);
        assertEquals (1, entity.getId().intValue());
        assertEquals("name", entity.getName());
    }
   
View Full Code Here

       
        Unmarshaller unmarshaller = getXMLContext().createUnmarshaller();
        unmarshaller.setClass(Entity.class);
        unmarshaller.setMapping(mapping);
       
        Entity entity = (Entity) unmarshaller.unmarshal(new InputSource(getClass().getResource(SAMPLE_FILE).toExternalForm()));
        assertNotNull (entity);
        assertEquals (1, entity.getId().intValue());
        assertEquals("name", entity.getName());
    }
   
View Full Code Here

            throws IOException, MarshalException, ValidationException {
        Configuration result = null;
        Unmarshaller unmarshaller = new Unmarshaller(Configuration.class);
        InputStreamReader reader = new InputStreamReader(stream);
        AttributeExpander handler = new AttributeExpander(reader);
        result = (Configuration) unmarshaller.unmarshal(handler);
        return setDefaults(result);
    }

    /**
     * Sets unpopulated elements in the supplied configuration with default
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.