Examples of XercesXsMarshaller


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

Examples of org.jboss.xb.binding.XercesXsMarshaller

      assertEquals("val", e.value);
   }

   public void testMarshallingNoValueXerces() throws Exception
   {
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false");
      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), new E(), writer);
      String xml = writer.getBuffer().toString();
      assertXmlEqual(XML_NO_VALUE, xml);
   }
View Full Code Here

Examples of org.jboss.xb.binding.XercesXsMarshaller

      assertXmlEqual(XML_NO_VALUE, xml);
   }

   public void testMarshallingWithValueXerces() throws Exception
   {
      XercesXsMarshaller marshaller = new XercesXsMarshaller();
      marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false");
      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), new E("val"), writer);
      String xml = writer.getBuffer().toString();
      assertXmlEqual(XML_WITH_VALUE, xml);
   }
View Full Code Here

Examples of org.jboss.xb.binding.XercesXsMarshaller

      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

Examples of org.jboss.xb.binding.XercesXsMarshaller

      Reader xsReader = new InputStreamReader(is);

      // create an instance of XML Schema marshaller
      //      MarshallerImpl marshaller = new MarshallerImpl(); // todo: replace XercesXsMarshaller by this
      XercesXsMarshaller marshaller = new XercesXsMarshaller();

      marshaller.setSchemaResolver(RESOLVER);

      // we need to specify what elements are top most (roots) providing namespace URI, prefix and local name
      marshaller.addRootElement(PRODUCER_NAMESPACE, "", "producer-configuration");

      // declare default namespace
      marshaller.declareNamespace("wpc", PRODUCER_NAMESPACE);

      // add schema location by declaring xsi namespace and adding xsi:schemaLocation attribute
      marshaller.declareNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
      marshaller.addAttribute("xsi", "schemaLocation", "string",
         PRODUCER_NAMESPACE + " http://www.jboss.org/portal/xsd/" + PRODUCER_XSD);

      // 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

Examples of org.jboss.xb.binding.XercesXsMarshaller

   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

Examples of org.jboss.xb.binding.XercesXsMarshaller

   }

   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);
   }
View Full Code Here

Examples of org.jboss.xb.binding.XercesXsMarshaller

   {
      Binding binding = new Binding();
      binding.setName("root");
      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);
   }
View Full Code Here

Examples of org.jboss.xb.binding.XercesXsMarshaller

      assertXmlEqual(XML_SIMPLE, marshalled);
   }

   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);
   }
View Full Code Here

Examples of org.jboss.xb.binding.XercesXsMarshaller

      assertXmlEqual(xml, marshalled);
   }

   public void testImmutableXerces() throws Exception
   {
      immutableTest(new XercesXsMarshaller());
   }
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.