Package javax.xml.bind

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()


        return context;
    }

    protected <T> Unmarshaller getUnmarshaller(Class<T> type) throws JAXBException {
        JAXBContext context = createContext(type);
        return context.createUnmarshaller();
    }

    private static <T> boolean isNotStreamCacheType(Class<T> type) {
        return !StreamCache.class.isAssignableFrom(type);
    }
View Full Code Here


            try {
                JAXBContext ctx = getJAXBContext();
                if (ctx == null) {
                    throw new RuntimeException ("JAXBContext is null -- cannot process gecode information");
                }
                u = ctx.createUnmarshaller();
                unmarshallerTL.set(u);
                return u;
            } catch (JAXBException ex) {
                Logger.getLogger(GeoCoder.class.getName()).log(Level.SEVERE, null, ex);
                ex.printStackTrace();
View Full Code Here

        producer.close();
    }
   
    private Book readBook(InputStream is) throws Exception {
        JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
        Unmarshaller u = c.createUnmarshaller();
        return (Book)u.unmarshal(is);
    }
   
    private String writeBook(Book b) throws Exception {
        JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
View Full Code Here

    @POST
    @Path("/books/stream")
    @Produces("text/xml")
    public Response addBookFromStream(StreamSource source) throws Exception {
        JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
        Unmarshaller u = c.createUnmarshaller();
        Book b = (Book)u.unmarshal(source);
        b.setId(124);
        return Response.ok(b).build();
    }
   
View Full Code Here

        throw new WebApplicationException();
    }
   
    private Response readBookFromInputStream(InputStream is) throws Exception {
        JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
        Unmarshaller u = c.createUnmarshaller();
        Book b = (Book)u.unmarshal(is);
        b.setId(124);
        return Response.ok(b).build();
    }
   
View Full Code Here

        return connect.getInputStream();
    }
   
    private Book readBook(InputStream is) throws Exception {
        JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
        Unmarshaller u = c.createUnmarshaller();
        return (Book)u.unmarshal(is);
    }
   
    @Ignore
    public static class TestResponseExceptionMapper implements ResponseExceptionMapper<BookNotFoundFault> {
View Full Code Here

        return bos.getOut().toString();       
    }

    private Book readBookFromInputStream(InputStream is) throws Exception {
        JAXBContext c = JAXBContext.newInstance(new Class[]{Book.class});
        Unmarshaller u = c.createUnmarshaller();
        return (Book)u.unmarshal(is);
    }
   
    @SuppressWarnings("unchecked")
    private Book readJSONBookFromInputStream(InputStream is) throws Exception {
View Full Code Here

            pkg = c.getPackage().getName();
            context = JAXBContext.newInstance(pkg, c.getClassLoader());
        } else {
            context = JAXBContext.newInstance(pkg);
        }
        Unmarshaller u = context.createUnmarshaller();
        Node node = parent.getFirstChild();          
        while (node != null) {
            if (node.getNodeType() == Node.ELEMENT_NODE && name.getLocalPart().equals(node.getLocalName())
                && name.getNamespaceURI().equals(node.getNamespaceURI())) {
                data = node;
View Full Code Here

     * @return An unmarshaller for XML
     */
    public static Unmarshaller getUnmarshaller(ScannedClassLoader classLoader) {
        try {
            JAXBContext context = getContext(classLoader);
            return context.createUnmarshaller();

        } catch (JAXBException ex) {
            logger.log(Level.SEVERE, null, ex);
        }
           
View Full Code Here

        objFactory = new ObjectFactory();
     
        wiki = objFactory.createXmlWiki();

        //A partir du XML instancié les classes !!
        Unmarshaller unmarshaller = context.createUnmarshaller();
        wiki = (XmlWiki) unmarshaller.unmarshal(new File("wotWiki.xml"));
        log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>unmarshaller wotWiki.xml");
        log.info(wiki.getACHIEVEMENTS().getCATEGORYACHIEVEMENT().get(0).getNAME());
      }
     
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.