Examples of createUnmarshaller()


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

   @Test
   public void testSeeAlso() throws Exception
   {
      JAXBContext ctx = new JAXBContextWrapper(null, Kunde.class);
      Kunde kunde = (Kunde) ctx.createUnmarshaller().unmarshal(
              new ByteArrayInputStream(kundeXml.getBytes()));
      System.out.println("HERE KUNDE!!!!" + kunde.getNachname());

   }
View Full Code Here

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

      logger.error("Could not find resource: " + fileName);
    } else {
      InputStream resourceStream =url.openStream();
 
      JAXBContext jc = JAXBContext.newInstance(thePackage);
      Unmarshaller unmarshaller = jc.createUnmarshaller();
      obj = ((JAXBElement)unmarshaller.unmarshal(resourceStream)).getValue();
    }
    return obj;
  }
View Full Code Here

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

  @SuppressWarnings("unchecked")
  public static Object buildFromString(String source, String thePackage) throws JAXBException, IOException {
    Object obj = null;
    JAXBContext jc = JAXBContext.newInstance(thePackage);
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    obj = ((JAXBElement)unmarshaller.unmarshal(new StringReader(source)));
    return obj;
  }
   
  public static void outputEntity(Object obj, String thePackage) throws JAXBException {
View Full Code Here

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

  @SuppressWarnings("unchecked")
  public static Object unmarshallFromInputStream(InputStream inputStream, String thePackage) throws JAXBException {
    Object obj = null;
    if (inputStream != null) {
      JAXBContext jc = JAXBContexts.get(thePackage);
      Unmarshaller unmarshaller = jc.createUnmarshaller();
      obj = ((JAXBElement)unmarshaller.unmarshal(inputStream)).getValue();
    }
    else
      logger.error("A null input stream was provided");
View Full Code Here

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

  }
 
  @SuppressWarnings("unchecked")
  public static Object unmarshallFromElement(Element element, String thePackage) throws JAXBException {
    JAXBContext jc = JAXBContexts.get(thePackage);
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    Object obj = ((JAXBElement) unmarshaller.unmarshal(element)).getValue();
    return obj;
  }
 
}
View Full Code Here

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

   public void testUnmarshalOrdertype() throws Exception
   {
      InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(
              "order_123.xml");
      JAXBContext jaxb = JAXBContext.newInstance(Ordertype.class);
      Unmarshaller u = jaxb.createUnmarshaller();
      Ordertype order = (Ordertype) u.unmarshal(in);
      Assert.assertNotNull(order);
      Assert.assertEquals("Ryan J. McDonough", order.getPerson());
   }
View Full Code Here

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

         GetMethod method = new GetMethod("http://localhost:8080/async-http-servlet-3.0-test/xml");
         int status = client.executeMethod(method);
         Assert.assertEquals(HttpResponseCodes.SC_OK, status);
         String result = method.getResponseBodyAsString();
         JAXBContext ctx = JAXBContext.newInstance(Customer.class);
         Customer cust = (Customer) ctx.createUnmarshaller().unmarshal(new StringReader(result));
         Assert.assertEquals("Bill Burke", cust.getName());
         method.releaseConnection();
      }

   }
View Full Code Here

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

        super.setUp();
        random = new Random();

        JAXBContext context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb");
        marshaller = context.createMarshaller();
        unmarshaller = context.createUnmarshaller();
        objectFactory = new ObjectFactory();

    }

    public void setPort(int port)
View Full Code Here

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

    return !jsInstallationsIterator.hasNext();
   }

  public void readInstallationDefinitionFile() throws JAXBException  {
   JAXBContext context = JAXBContext.newInstance( Installations.class );
   Unmarshaller unmarshaller = context.createUnmarshaller();
   installations = (Installations) unmarshaller.unmarshal( installationsDefinitionFile );
   listOfInstallations = (ArrayList)installations.getInstallation();
   reset();
   }
View Full Code Here

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

        JAXBRuntimeBinder annReader = new JAXBRuntimeBinder(mmgr, clr);
        //jaxbConfig.put(JAXBRIContext.DEFAULT_NAMESPACE_REMAP, "DefaultNamespace");
        jaxbConfig.put(JAXBRIContext.ANNOTATION_READER, annReader);

        JAXBContext jaxbContext = JAXBContext.newInstance(new Class[]{cls}, jaxbConfig);
        return jaxbContext.createUnmarshaller().unmarshal(node);
    }

    public JAXBRuntimeBinder(MetaDataManager metaDataMgr, ClassLoaderResolver clr)
    {
        this.metaDataMgr = metaDataMgr;
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.