Examples of marshalDocument()


Examples of org.jibx.runtime.IMarshallingContext.marshalDocument()

         uctx.unmarshalDocument(new FileInputStream("src/test/resources/portal/portal/classic/navigation.xml"), null);
      assertEquals(PageNavigation.class, obj.getClass());

      IMarshallingContext mctx = bfact.createMarshallingContext();
      mctx.setIndent(2);
      mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream("target/navigation.xml"));

      obj = uctx.unmarshalDocument(new FileInputStream("target/navigation.xml"), null);
      assertEquals(PageNavigation.class, obj.getClass());
   }
View Full Code Here

Examples of org.jibx.runtime.IMarshallingContext.marshalDocument()

            new FileInputStream("src/test/resources/portal/portal/classic/portlet-preferences.xml"), null);
      assertEquals(PortletPreferencesSet.class, obj.getClass());

      IMarshallingContext mctx = bfact.createMarshallingContext();
      mctx.setIndent(2);
      mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream("target/portlet-preferences.xml"));
      assertEquals(PortletPreferencesSet.class, obj.getClass());
   }

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

Examples of org.jibx.runtime.IMarshallingContext.marshalDocument()

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            XMLOutputFactory ofact = XMLOutputFactory.newInstance();
            XMLStreamWriter wrtr = ofact.createXMLStreamWriter(bos, enc);
            mctx.setXmlWriter(new StAXWriter(bfact.getNamespaces(), wrtr));
            mctx.marshalDocument(obj);
        } catch (XMLStreamException e) {
            throw new JiBXException("Error creating writer", e);
        }
       
        // compare with original input document
View Full Code Here

Examples of org.jibx.runtime.IMarshallingContext.marshalDocument()

                // marshal binding out to file
                IBindingFactory bfact =
                    BindingDirectory.getFactory("normal", BindingElement.class);
                IMarshallingContext mctx = bfact.createMarshallingContext();
                mctx.setIndent(2);
                mctx.marshalDocument(binding, "UTF-8", null,
                    new FileOutputStream(fname));
               
            } catch (JiBXException ex) {
                ex.printStackTrace(System.out);
                System.exit(1);
View Full Code Here

Examples of org.jibx.runtime.IMarshallingContext.marshalDocument()

                   
                    // marshal root object back out to document in memory
                    IMarshallingContext mctx = factory.createMarshallingContext();
                    ByteArrayOutputStream bos = new ByteArrayOutputStream();
                    mctx.setIndent(2);
                    mctx.marshalDocument(obj, "UTF-8", null, bos);
                   
                    // compare with original input document
                    InputStreamReader brdr =
                        new InputStreamReader(new ByteArrayInputStream(bos.toByteArray()), "UTF-8");
                    InputStreamReader frdr = new InputStreamReader(resolver.getContent(), enc);
View Full Code Here

Examples of org.jibx.runtime.IMarshallingContext.marshalDocument()

            Writer writer = new OutputStreamWriter(stream, "utf-8");
            IBindingFactory factory = BindingDirectory.getFactory(SchemaUtils.XS_PREFIX_BINDING, SchemaElement.class);
            IMarshallingContext ictx = factory.createMarshallingContext();
            ictx.setOutput(writer);
            ictx.setIndent(2);
            ictx.marshalDocument(schema);
            writer.close();
        }
    }

    /**
 
View Full Code Here

Examples of org.jibx.runtime.IMarshallingContext.marshalDocument()

                   
                    // marshal root object back out to document in memory
                    IMarshallingContext mctx = factory.createMarshallingContext();
                    ByteArrayOutputStream bos = new ByteArrayOutputStream();
                    mctx.setIndent(2);
                    mctx.marshalDocument(schema, "UTF-8", null, bos);
                   
                    // compare with original input document
                    InputStreamReader brdr =
                        new InputStreamReader(new ByteArrayInputStream(bos.toByteArray()), "UTF-8");
                    InputStreamReader frdr = new InputStreamReader(resolver.getContent(), enc);
View Full Code Here

Examples of org.jibx.runtime.IMarshallingContext.marshalDocument()

      // marshal object back out to file (with nice indentation, as UTF-8)
      IMarshallingContext mctx = bfact.createMarshallingContext();
      mctx.setIndent(2);
      FileOutputStream out = new FileOutputStream(args[1]);
      mctx.setOutput(out, null);
      mctx.marshalDocument(order);
      System.out.println("Unmarshalled and marshalled order with " +
          order.getItems().size() + " items and total value " + total);
     
    } catch (FileNotFoundException e) {
      e.printStackTrace();
View Full Code Here

Examples of org.jibx.runtime.IMarshallingContext.marshalDocument()

    protected String writeSchema(SchemaElement schema) throws Exception {
        StringWriter writer = new StringWriter();
        IMarshallingContext ictx = m_bindingFactory.createMarshallingContext();
        ictx.setOutput(writer);
        ictx.setIndent(2);
        ictx.marshalDocument(schema);
        return writer.toString();
    }
   
    /**
     * Verify that output schema matches original input. Fails the test if there's any difference between the two
View Full Code Here

Examples of org.jibx.runtime.IMarshallingContext.marshalDocument()

      // marshal object back out to file (with nice indentation, as UTF-8)
      IMarshallingContext mctx = bfact.createMarshallingContext();
      mctx.setIndent(2);
      FileOutputStream out = new FileOutputStream(args[1]);
      mctx.setOutput(out, null);
      mctx.marshalDocument(order);
      System.out.println("Unmarshalled and marshalled order with " +
          order.getItems().size() + " items and total value " + total);
     
    } catch (FileNotFoundException e) {
      e.printStackTrace();
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.