Examples of createMarshallingContext()


Examples of org.jibx.runtime.IBindingFactory.createMarshallingContext()

               
                // version found, create marshaller for the associated binding
                IBindingFactory fact = BindingDirectory.
                    getFactory(m_versionBindings[i], obj.getClass());
                MarshallingContext context =
                    (MarshallingContext)fact.createMarshallingContext();
               
                // configure marshaller for writing document
                context.setIndent(m_outputIndent);
                if (m_outputWriter == null) {
                    if (m_outputStream == null) {
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory.createMarshallingContext()

                total += item.getPrice() * item.getQuantity();
            }
            order.setTotal(new Float(total));
           
      // 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 " +
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory.createMarshallingContext()

        }
    }
   
    private static void writeBinding(BindingHolder holder, OutputStream os) throws JiBXException, IOException {
        IBindingFactory fact = BindingDirectory.getFactory("normal", BindingElement.class);
        IMarshallingContext ictx = fact.createMarshallingContext();
        ictx.setIndent(2);
        ictx.setOutput(os, null);
        ((IMarshallable)holder.getBinding()).marshal(ictx);
        ictx.getXmlWriter().flush();
    }
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory.createMarshallingContext()

                total += item.getPrice() * item.getQuantity();
            }
            order.setTotal(new Float(total));
           
      // 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 " +
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory.createMarshallingContext()

     * @param root the Object to marshal
     * @return the Document representation
     */
    private static Document marshalActualDocument(Object root) throws JiBXException {
        final IBindingFactory bfact = BindingDirectory.getFactory(root.getClass());
        final IMarshallingContext mctx = bfact.createMarshallingContext();
       
        final JDOMWriter jdomWriter = new JDOMWriter(bfact.getNamespaces());
       
        return marshalDocument(root, mctx, jdomWriter);
    }
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory.createMarshallingContext()

        return marshalDocument(root, mctx, jdomWriter);
    }
   
    private static Document marshalActualDocument(Object root, Document document) throws JiBXException {
        final IBindingFactory bfact = BindingDirectory.getFactory(root.getClass());
        final IMarshallingContext mctx = bfact.createMarshallingContext();
       
        final JDOMWriter jdomWriter = new JDOMWriter(bfact.getNamespaces(), document);
       
        return marshalDocument(root, mctx, jdomWriter);
    }
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory.createMarshallingContext()

        return marshalDocument(root, mctx, jdomWriter);
    }
   
    private static Document marshalActualDocument(Object root, Element element) throws JiBXException {
        final IBindingFactory bfact = BindingDirectory.getFactory(root.getClass());
        final IMarshallingContext mctx = bfact.createMarshallingContext();
       
        final JDOMWriter jdomWriter = new JDOMWriter(bfact.getNamespaces(), element);
       
        return marshalDocument(root, mctx, jdomWriter);
    }
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory.createMarshallingContext()

    public static void writeSchemas(File dir, Collection schemas) throws JiBXException, IOException {
        IBindingFactory fact = BindingDirectory.getFactory(SchemaUtils.XS_PREFIX_BINDING, SchemaElement.class);
        for (Iterator iter = schemas.iterator(); iter.hasNext();) {
            SchemaHolder holder = (SchemaHolder)iter.next();
            if (!holder.isExistingFile()) {
                IMarshallingContext ictx = fact.createMarshallingContext();
                File file = new File(dir, holder.getFileName());
                ictx.setOutput(new FileOutputStream(file), null);
                ictx.setIndent(2);
                ((IMarshallable)holder.getSchema()).marshal(ictx);
                ictx.getXmlWriter().flush();
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory.createMarshallingContext()

               
                // version found, create marshaller for the associated binding
                IBindingFactory fact = BindingDirectory.
                    getFactory(m_versionBindings[i], obj.getClass());
                MarshallingContext context =
                    (MarshallingContext)fact.createMarshallingContext();
               
                // configure marshaller for writing document
                context.setIndent(m_outputIndent);
                if (m_outputWriter == null) {
                    if (m_outputStream == null) {
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory.createMarshallingContext()

            Customer customer = (Customer)uctx.unmarshalDocument(in, null);
           
            // you can add code here to alter the unmarshalled customer
           
      // 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.marshalDocument(customer, "UTF-8", null, out);
     
    } catch (FileNotFoundException e) {
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.