Package org.jboss.xb.binding

Examples of org.jboss.xb.binding.XercesXsMarshaller


      assertEquals(PurchaseOrder.INSTANCE, o);
   }

   public void testMarshallingXerces() throws Exception
   {
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      marshaller.setSchemaResolver(SCHEMA_RESOLVER);
      marshaller.mapClassToXsiType(UKAddress.class, PO_NS, "UKAddress");
      marshaller.mapClassToXsiType(USAddress.class, PO_NS, "USAddress");

      MappingObjectModelProvider provider = new MappingObjectModelProvider();

      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(PO_XSD), provider, PurchaseOrder.INSTANCE, writer);
      assertXmlEqual(PO_XML, writer.getBuffer().toString());
   }
View Full Code Here


      assertArrayOfAnyDom(o);
   }

   public void testMarshallingXercesGenericElement() throws Exception
   {
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      setupGeMarshaller(marshaller);

      MappingObjectModelProvider provider = new MappingObjectModelProvider();

      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), provider, ArrayOfAny.GE_INSTANCE, writer);
      String marshalled = writer.getBuffer().toString();
      assertXmlEqual(XML, marshalled);
   }
View Full Code Here

      assertXmlEqual(XML, marshalled);
   }

   public void testMarshallingXercesDom() throws Exception
   {
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      setupDomMarshaller(marshaller);

      MappingObjectModelProvider provider = new MappingObjectModelProvider();

      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), provider, ArrayOfAny.DOM_INSTANCE, writer);
      String marshalled = writer.getBuffer().toString();
      assertXmlEqual(XML, marshalled);
   }
View Full Code Here

   }

   public void testMultidimArrMarshallingXerces() throws Exception
   {
      StringWriter writer = new StringWriter();
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      marshaller.marshal(new StringReader(getMultiDimArrayXsd(false)),
         new MappingObjectModelProvider(),
         MULTIDIM_ARR,
         writer
      );
      String marshalled = writer.getBuffer().toString();
View Full Code Here

      ListWrapper lists = new ListWrapper();
      lists.field1 = Arrays.asList(new String[]{"str1", "str2", "str3"});
      lists.field2 = Arrays.asList(new Boolean[]{Boolean.TRUE, Boolean.FALSE, Boolean.TRUE});

      StringWriter writer = new StringWriter();
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      MappingObjectModelProvider provider = new MappingObjectModelProvider();
      provider.mapFieldToElement(ListWrapper.class, "field2", "http://jboss.org/test/xml/list", "e", null);
      marshaller.marshal(new StringReader(LIST_TYPE_XSD), provider, lists, writer);

      String xml = writer.getBuffer().toString();
      assertXmlEqual(LIST_TYPE_XML, xml);
   }
View Full Code Here

                     new QName("http://ns2", "name2"),
                     new QName("http://ns3", "name3")
         };

      StringWriter writer = new StringWriter();
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      MappingObjectModelProvider provider = new MappingObjectModelProvider();
      marshaller.marshal(new StringReader(LIST_TYPE_XSD), provider, lists, writer);

      String xml = writer.getBuffer().toString();
      unmarshalQNameArray(xml);
   }
View Full Code Here

      assertArrayOfAnyDom(o);
   }

   public void testMarshallingXercesGenericElement() throws Exception
   {
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      setupGeMarshaller(marshaller);

      MappingObjectModelProvider provider = new MappingObjectModelProvider();

      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), provider, ArrayOfAny.GE_INSTANCE, writer);
      String marshalled = writer.getBuffer().toString();
      assertXmlEqual(XML, marshalled);
   }
View Full Code Here

      assertXmlEqual(XML, marshalled);
   }

   public void testMarshallingXercesDom() throws Exception
   {
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      setupDomMarshaller(marshaller);

      MappingObjectModelProvider provider = new MappingObjectModelProvider();

      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), provider, ArrayOfAny.DOM_INSTANCE, writer);
      String marshalled = writer.getBuffer().toString();
      assertXmlEqual(XML, marshalled);
   }
View Full Code Here

   private String marshalXerces(Book book)
      throws Exception
   {
      StringWriter writer = new StringWriter();
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      initMarshaller(marshaller);
      marshaller.setSchemaResolver(SCHEMA_RESOLVER);
      marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), Collections.singleton(book), writer);
      return writer.getBuffer().toString();
   }
View Full Code Here

      assertEquals(E.INSTANCE, o);
   }

   public void testMarshallingXerces() throws Exception
   {
      XercesXsMarshaller marshaller = new XercesXsMarshaller(); //new MarshallerImpl();
      marshaller.setSchemaResolver(SCHEMA_RESOLVER);
      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), E.INSTANCE, writer);
      assertXmlEqual(XML, writer.getBuffer().toString());
   }
View Full Code Here

TOP

Related Classes of org.jboss.xb.binding.XercesXsMarshaller

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.