Package org.exolab.castor.xml

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


     * @throws Exception if anything goes wrong during the test
     */
    protected Object testUnmarshal(final InputStream stream) throws Exception {
        Object result = null;
        final Unmarshaller unmar = createUnmarshaler();
        result = unmar.unmarshal(new InputSource(stream));
        return result;
    }

    private Unmarshaller createUnmarshaler() throws Exception {
        //-- Configuration for unmarshaler?  Use config from unit test case if available
View Full Code Here


            unm.setClassLoader(Mapping.class.getClassLoader());
            unm.setIDResolver(_idResolver);
            unm.setUnmarshalListener(
                    new MappingUnmarshallListener(this, mapping, resolver));

            MappingRoot loaded = (MappingRoot) unm.unmarshal(source);
               
            // Load all the included mapping by reference
            //-- note: this is just for processing any
            //-- includes which may have previously failed
            //-- using the IncludeListener...and to
View Full Code Here

        JdoConf jdoConf = null;
       
        Unmarshaller unmarshaller = new Unmarshaller(JdoConf.class);
        try {
            unmarshaller.setEntityResolver(new DTDResolver(resolver));
            jdoConf = (JdoConf) unmarshaller.unmarshal(source);
        } catch (MarshalException e) {
            LOG.info(NOTE_096);
            throw new MappingException(e);
        } catch (ValidationException e) {
            throw new MappingException(e);
View Full Code Here

            Unmarshaller unmarshaller = context.createUnmarshaller();
            InputStream stream = this.getClass().getClassLoader().getResourceAsStream("withmapping-input.xml");
            Assert.assertNotNull("InputStream must not be null", stream);
            InputSource is = new InputSource(stream);
            Assert.assertNotNull("Inputstream must not be null", is);
            Object o = unmarshaller.unmarshal(is);
            Assert.assertNotNull("Result of unmarshal must not be null", o);
        } catch (MappingException e) {
            LOG.error("Failed with exception: " + e, e);
            Assert.fail("Failed with exception: " + e);
        } catch (MarshalException e) {
View Full Code Here

            Unmarshaller u = context.createUnmarshaller();
            InputStream stream = this.getClass().getClassLoader().getResourceAsStream("genpackage-input.xml");
            Assert.assertNotNull("InputStream must not be null", stream);
            InputSource is = new InputSource(stream);
            Assert.assertNotNull("Inputstream must not be null", is);
            Object o = u.unmarshal(is);
            Assert.assertNotNull("Result of unmarshal must not be null", o);
        } catch (ResolverException e) {
            LOG.error("Failed with exception: " + e, e);
            Assert.fail("Failed with exception: " + e);
        } catch (MarshalException e) {
View Full Code Here

                    .setResolver((XMLClassDescriptorResolver) classDescriptorResolver);
            InputStream stream = this.getClass().getClassLoader().getResourceAsStream("withmapping-input.xml");
            Assert.assertNotNull("InputStream must not be null", stream);
            InputSource is = new InputSource(stream);
            Assert.assertNotNull("Inputstream must not be null", is);
            Object o = unmarshaller.unmarshal(is);
            Assert.assertNotNull("Result of unmarshal must not be null", o);
        } catch (MappingException e) {
            LOG.error("Failed with exception: " + e, e);
            Assert.fail("Failed with exception: " + e);
        } catch (MarshalException e) {
View Full Code Here

            unmarshaller.setResolver(classDescriptorResolver);
            InputStream stream = this.getClass().getClassLoader().getResourceAsStream("genpackage-input.xml");
            Assert.assertNotNull("InputStream must not be null", stream);
            InputSource is = new InputSource(stream);
            Assert.assertNotNull("Inputstream must not be null", is);
            Object o = unmarshaller.unmarshal(is);
            Assert.assertNotNull("Result of unmarshal must not be null", o);
        } catch (ResolverException e) {
            LOG.error("Failed with exception: " + e, e);
            Assert.fail("Failed with exception: " + e);
        } catch (MarshalException e) {
View Full Code Here

        mapping.loadMapping(Expected.class.getResource(MAPPING));
       
        // 2. Unmarshal the data
        Unmarshaller unmar = new Unmarshaller(mapping);
        InputSource source = new InputSource(expected.toExternalForm());
        return (Expected) unmar.unmarshal(source);
    }

    //--------------------------------------------------------------------------

    /**
 
View Full Code Here

    public Object getObject(InputStream stream, Map parameters) throws ConverterException {
        try {
            ReferenceFieldHandler.setObjectMap((Map)parameters.get("objectmap"));
            Unmarshaller unmarshaller = new Unmarshaller((Mapping)this.mappings.get(parameters.get("profiletype")));
            Object result = unmarshaller.unmarshal(new InputSource(stream));
            stream.close();
            return result;
        } catch (MappingException e) {
            throw new ConverterException("can't create Unmarshaller", e);
        } catch (Exception e) {
View Full Code Here

            Unmarshaller unmarshaller = new Unmarshaller(portletXMLMapping);
      unmarshaller.setIgnoreExtraElements(true);
            unmarshaller.setEntityResolver(this.resolver);
            unmarshaller.setValidation(false);
            PortletApplicationDefinitionImpl portletApp =
                (PortletApplicationDefinitionImpl)unmarshaller.unmarshal( source );

            WebApplicationDefinitionImpl webApp = null;

            if (webXml.exists()) {
                source = new InputSource(new FileInputStream(webXml));
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.