Package javax.xml.bind

Examples of javax.xml.bind.Unmarshaller


            javax.xml.validation.Schema schema = sf.newSchema(
                GenerationTool.class.getResource("/xsd/" + Constants.XSD_CODEGEN)
            );

            JAXBContext ctx = JAXBContext.newInstance(Configuration.class);
            Unmarshaller unmarshaller = ctx.createUnmarshaller();
            unmarshaller.setSchema(schema);
            unmarshaller.setEventHandler(new ValidationEventHandler() {
                @Override
                public boolean handleEvent(ValidationEvent event) {
                    log.warn("Unmarshal warning", event.getMessage());
                    return true;
                }
            });
            return (Configuration) unmarshaller.unmarshal(new StringReader(xml));
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here


     * @throw ClassCastException If the input file does not map to ViewProperties
     * @throw JAXBException Upon error reading the XML file
     */
    public static ViewProperties decode(Reader r) throws JAXBException {
        // Unmarshall the XML into a ViewProperties class
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        return (ViewProperties)unmarshaller.unmarshal(r);
    }
View Full Code Here

        marshaller.marshal(this, os);
    }

    public static DeployedModel decode(InputStream in) throws JAXBException {
        /* Read in from stream */
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        DeployedModel info = (DeployedModel)unmarshaller.unmarshal(in);

        return info;
    }
View Full Code Here

     * @throw ClassCastException If the input file does not map to ModuleInfo
     * @throw JAXBException Upon error reading the XML file
     */
    public static ModuleInfo decode(Reader r) throws JAXBException {
        /* Read in from stream */
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        ModuleInfo info = (ModuleInfo)unmarshaller.unmarshal(r);
       
        /* Convert array into hash map */
        info.attributeMap.clear();
        for (Attribute attribute : info.attributes) {
            info.attributeMap.put(attribute.key, attribute.value);
View Full Code Here

     * @param is The input stream of the XML representation
     * @throw ClassCastException If the input file does not map to WFSCellChildren
     * @throw JAXBException Upon error reading the XML stream
     */
    public static WorldRootList decode(InputStream is) throws JAXBException {
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        return (WorldRootList)unmarshaller.unmarshal(is);       
    }
View Full Code Here

     * @param r The input reader of the version XML file
     * @throw ClassCastException If the input file does not map to ModuleInfo
     * @throw JAXBException Upon error reading the XML file
     */
    public static ModuleArt decode(Reader r) throws JAXBException {
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        return (ModuleArt)unmarshaller.unmarshal(r);
    }
View Full Code Here

     * @param r The reader of the XML stream
     * @throw ClassCastException If the input file does not map to this class
     * @throw JAXBException Upon error reading the XML stream
     */
    public static CellDescriptor decode(Reader r) throws JAXBException {
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        return (CellDescriptor)unmarshaller.unmarshal(r);       
    }
View Full Code Here

     * @param r The input stream of the version XML file
     * @throw ClassCastException If the input file does not map to ModuleRepository
     * @throw JAXBException Upon error reading the XML file
     */
    public static ModuleRepository decode(Reader r) throws JAXBException {
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        ModuleRepository list = (ModuleRepository)unmarshaller.unmarshal(r);
        list.updateRepositoryList();
        return list;
    }
View Full Code Here

     * @param is The input stream of the XML representation
     * @throw ClassCastException If the input file does not map to CellList
     * @throw JAXBException Upon error reading the XML stream
     */
    public static CellList decode(String relativePath, InputStream is) throws JAXBException {
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        CellList children = (CellList)unmarshaller.unmarshal(is);
        children.relativePath = relativePath;
        return children;
    }
View Full Code Here

     * @param r The input reader of the XML representation
     * @throw ClassCastException If the input file does not map to WFSCellList
     * @throw JAXBException Upon error reading the XML stream
     */
    public static ModuleArtList decode(Reader r) throws JAXBException {
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        ModuleArtList children = (ModuleArtList)unmarshaller.unmarshal(r);
        return children;
    }
View Full Code Here

TOP

Related Classes of javax.xml.bind.Unmarshaller

Copyright © 2018 www.massapicom. 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.