Package org.jboss.xb.binding

Examples of org.jboss.xb.binding.Unmarshaller


   }

   public void testUnmarshalling() throws Exception
   {
      SchemaBinding schema = XsdBinder.bind(new StringReader(PO_XSD), null, SCHEMA_RESOLVER);
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Object o = unmarshaller.unmarshal(new StringReader(PO_XML), schema);
      assertEquals(PurchaseOrder.INSTANCE, o);
   }
View Full Code Here


   }

   public void testUnmarshalCollection() throws Exception
   {
      SchemaBinding schema = XsdBinder.bind(new StringReader(COLLECTION_XSD), null, SCHEMA_RESOLVER);
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Object o = unmarshaller.unmarshal(new StringReader(COLLECTION_XML), schema);
     
      assertNotNull(o);
      assertTrue(o instanceof PurchaseOrder);
     
      PurchaseOrder po = (PurchaseOrder) o;
View Full Code Here

     
      // TODO: the xml diff trims whitespaces...
      //assertXmlFileContent("IgnorableWhitespaceContent.xml", writer.getBuffer().toString());
      //System.out.println(writer.getBuffer().toString());
     
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Object o = unmarshaller.unmarshal(new StringReader(writer.getBuffer().toString()), schema);
     
      assertEquals(top, o);
   }
View Full Code Here

   {
      String url = findXML("IgnorableWhitespaceContent.xml");
     
      ObjectModelFactory omf = new OMF();
     
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Object o = unmarshaller.unmarshal(url, omf, null);
     
      assertNotNull(o);
      assertTrue(o instanceof Top);
      Top top = (Top) o;
      assertEquals(2, top.string.size());
View Full Code Here

   {
      if (resolver == null)
         resolver = defaultResolver;
     
      long start = System.currentTimeMillis();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
      try
      {
         Object result = unmarshaller.unmarshal(url, resolver);
         log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
         return result;
      }
      catch (Exception e)
      {
View Full Code Here

    * @throws Exception for any error
    */
   public Object unmarshal(String url, SchemaBinding schema) throws Exception
   {
      long start = System.currentTimeMillis();
      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
      log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
      try
      {
         Object result = unmarshaller.unmarshal(url, schema);
         log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
         return result;
      }
      catch (Exception e)
      {
View Full Code Here

   public void testUnmarshallingGenericElement() throws Exception
   {
      SchemaBinding schema = getSchemaBinding(true);
     
      // unmarshal
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Object o = unmarshaller.unmarshal(new StringReader(XML), schema);

      assertArrayOfAnyGenericElement(o);
   }
View Full Code Here

   public void testUnmarshallingDom() throws Exception
   {
      SchemaBinding schema = getSchemaBinding(false);

      // unmarshal
      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      Object o = unmarshaller.unmarshal(new StringReader(XML), schema);

      assertArrayOfAnyDom(o);
   }
View Full Code Here

      {
         LOG.trace("Parsing " + url);
      }
      long start = System.currentTimeMillis();

      Unmarshaller unmarshaller = factory.newUnmarshaller();
      KernelDeployment deployment = null;
      try
      {
         deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver);
      }
      catch (JBossXBException e)
      {
         throw new RuntimeException("Failed to parse xml " + url, e);
      }
View Full Code Here

            try
            {
               in = IOTools.safeBufferedWrapper(url.openStream());

               // Validate
               Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
               unmarshaller.setNamespaceAware(true);
               unmarshaller.setSchemaValidation(false);
               unmarshaller.setValidation(false);

               //
               PortletApplicationModelFactory factory = new PortletApplicationModelFactory();

               // Unmarshal
               PortletApplication10MetaData portletApplicationMD = (PortletApplication10MetaData)unmarshaller.unmarshal(in, new ValueTrimmingFilter(factory), null);

               //
               return portletApplicationMD;
            }
            finally
View Full Code Here

TOP

Related Classes of org.jboss.xb.binding.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.