Package org.jboss.xb.binding.sunday.marshalling

Examples of org.jboss.xb.binding.sunday.marshalling.MarshallerImpl$MarshallingContextImpl


   public void testMarshallingSunday() throws Exception
   {
      SchemaBinding schema = XsdBinder.bind(new StringReader(PO_XSD), null, SCHEMA_RESOLVER);

      MarshallerImpl marshaller = new MarshallerImpl();
      marshaller.setSchemaResolver(SCHEMA_RESOLVER);
      marshaller.mapClassToXsiType(UKAddress.class, PO_NS, "UKAddress");
      marshaller.mapClassToXsiType(USAddress.class, PO_NS, "USAddress");

      StringWriter writer = new StringWriter();

      marshaller.marshal(schema, null, PurchaseOrder.INSTANCE, writer);
      assertXmlEqual(PO_XML, writer.getBuffer().toString());
   }
View Full Code Here


   public void testMarshalCollectionSunday() throws Exception
   {
      SchemaBinding schema = XsdBinder.bind(new StringReader(COLLECTION_XSD), null, SCHEMA_RESOLVER);

      MarshallerImpl marshaller = new MarshallerImpl();
      marshaller.setSchemaResolver(SCHEMA_RESOLVER);
      marshaller.mapClassToXsiType(UKAddress.class, PO_NS, "UKAddress");
      marshaller.mapClassToXsiType(USAddress.class, PO_NS, "USAddress");

      StringWriter writer = new StringWriter();

      PurchaseOrder po = new PurchaseOrder();
      po.address = new Address[2];
      po.address[0] = PurchaseOrder.INSTANCE.billTo;
      po.address[1] = PurchaseOrder.INSTANCE.shipTo;
     
      marshaller.marshal(schema, null, po, writer);
      assertXmlEqual(COLLECTION_XML, writer.getBuffer().toString());
   }
View Full Code Here

     
      Top top = new Top();
      top.string = new ArrayList();
      top.string.add(" ");
      top.string.add("\n      newline, 6 spaces, newline, 3 spaces\n   ");
      MarshallerImpl marshaller = new MarshallerImpl();
      StringWriter writer = new StringWriter();
      marshaller.marshal(schema, null, top, writer);
     
      // TODO: the xml diff trims whitespaces...
      //assertXmlFileContent("IgnorableWhitespaceContent.xml", writer.getBuffer().toString());
      //System.out.println(writer.getBuffer().toString());
     
View Full Code Here

      assertXmlEqual(XML, marshalled);
   }

   public void testMarshallingSundayGenericElement() throws Exception
   {
      MarshallerImpl marshaller = new MarshallerImpl();
      setupGeMarshaller(marshaller);
      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), null, ArrayOfAny.GE_INSTANCE, writer);
      String marshalled = writer.getBuffer().toString();
      assertXmlEqual(XML, marshalled);
   }
View Full Code Here

      assertXmlEqual(XML, marshalled);
   }

   public void testMarshallingSundayDom() throws Exception
   {
      MarshallerImpl marshaller = new MarshallerImpl();
      setupDomMarshaller(marshaller);
      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), null, ArrayOfAny.DOM_INSTANCE, writer);
      String marshalled = writer.getBuffer().toString();
      assertXmlEqual(XML, marshalled);
   }
View Full Code Here

   public void testMarshalling() throws Exception
   {
      String ns = "http://www.jboss.org/test/xml/collections";

      MarshallerImpl marshaller = new MarshallerImpl();
      marshaller.addRootElement(new QName(ns, "collections"));
      marshaller.setRootTypeQName(new QName(ns, "collections"));
      marshaller.declareNamespace(null, ns);

      String xsd = getFullPath("xml/collections.xsd");
      StringWriter xml = new StringWriter();
      marshaller.marshal(xsd, new MappingObjectModelProvider(), Collections.getInstance(), xml);

      String marshalled = xml.getBuffer().toString();
      try
      {
         unmarshalCollections(new StringReader(marshalled));
View Full Code Here

   }

   public void testMultidimArrMarshallingSunday() throws Exception
   {
      StringWriter writer = new StringWriter();
      MarshallerImpl marshaller = new MarshallerImpl();
      marshaller.marshal(new StringReader(getMultiDimArrayXsd(false)), null, MULTIDIM_ARR, writer);
      String marshalled = writer.getBuffer().toString();
      assertXmlEqual(MULTIDIM_ARR_XML, marshalled);
   }
View Full Code Here

      SchemaBinding schema = XsdBinder.bind(new StringReader(LIST_TYPE_XSD), null);
      schema.setIgnoreUnresolvedFieldOrClass(false);

      StringWriter writer = new StringWriter();
      MarshallerImpl marshaller = new MarshallerImpl();
      marshaller.marshal(schema, null, lists, writer);

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

      SchemaBinding schema = XsdBinder.bind(new StringReader(LIST_TYPE_XSD), null);
      schema.setIgnoreUnresolvedFieldOrClass(false);

      StringWriter writer = new StringWriter();
      MarshallerImpl marshaller = new MarshallerImpl();
      marshaller.marshal(schema, null, lists, writer);

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

      assertXmlEqual(XML, marshalled);
   }

   public void testMarshallingSundayGenericElement() throws Exception
   {
      MarshallerImpl marshaller = new MarshallerImpl();
      setupGeMarshaller(marshaller);
      StringWriter writer = new StringWriter();
      marshaller.marshal(new StringReader(XSD), null, ArrayOfAny.GE_INSTANCE, writer);
      String marshalled = writer.getBuffer().toString();
      assertXmlEqual(XML, marshalled);
   }
View Full Code Here

TOP

Related Classes of org.jboss.xb.binding.sunday.marshalling.MarshallerImpl$MarshallingContextImpl

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.