Package org.jboss.xb.binding

Examples of org.jboss.xb.binding.XercesXsMarshaller.marshal()


   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());
   }

   public void testMarshallingSunday() throws Exception
   {
View Full Code Here


      // create an instance of Object Model Provider
      ObjectModelProvider provider = new ProducerConfigurationProvider();

      marshaller.setProperty("org.jboss.xml.binding.marshalling.indent", "true");
      marshaller.marshal(xsReader, provider, configuration, xmlOutput);

      // close XML Schema reader
      xsReader.close();

      config.createNewFile();
View Full Code Here

   {
      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();
   }

   private String marshalSunday(Book book)
      throws Exception
View Full Code Here

   public void testMarshallingXerces() throws Exception
   {
      StringWriter writer = new StringWriter();
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false");
      marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), E.INSTANCE, writer);
      String xml = writer.getBuffer().toString();
      assertXmlEqual(XML, xml);
   }

   public void testMarshallingSunday() throws Exception
View Full Code Here

      binding.value4 = new Binding.Value4("val4");
      StringWriter writer = new StringWriter();
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false");
      String file = getPath("xml/jbxb/characters/schema1.xsd").getFile();
      marshaller.marshal(new FileReader(file), new MappingObjectModelProvider(), binding, writer);
      String xml = writer.getBuffer().toString();
      assertEquals(XML_VALUE4, xml);
   }

   public void testValue4MarshallingSunday() throws Exception
View Full Code Here

   public void testSimpleMarshallingXerces() throws Exception
   {
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false");
      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), GLOBAL_SIMPLE, writer);
      String marshalled = writer.getBuffer().toString();
      assertXmlEqual(XML_SIMPLE, marshalled);
   }

   public void testAllUnmarshalling() throws Exception
View Full Code Here

      MappingObjectModelProvider provider = new MappingObjectModelProvider();
      provider.mapFieldToElement(ArrayWrapper.class, "stringArray", "http://www.jboss.org/xml/test/arraywrapper", "stringArray", null);

      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), provider, ArrayWrapper.STRING_ARR_INSTANCE, writer);
      assertXmlEqual(XML, writer.getBuffer().toString());
   }

   public void testUnmarshalStringArray() throws Exception
   {
View Full Code Here

      marshaller.mapClassToGlobalElement(ArrayWrapper.class, "arr", "http://www.jboss.org/xml/test/arraywrapper", null, null);

      MappingObjectModelProvider provider = new MappingObjectModelProvider();

      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), provider, ArrayWrapper.STRING_ARR_ARR_INSTANCE, writer);
      assertXmlEqual(XML_STRING_ARR_ARR, writer.getBuffer().toString());
   }

   public void testUnmarshalStringArrayArray() throws Exception
   {
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.