Package org.jibx.runtime.impl

Examples of org.jibx.runtime.impl.StAXWriter


        IMarshallingContext mctx = bfact.createMarshallingContext();
        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);
        }
       
View Full Code Here


        IMarshallingContext mctx = bfact.createMarshallingContext();
        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);
        }
       
View Full Code Here

        IMarshallingContext mctx = obf.createMarshallingContext();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            XMLOutputFactory ofact = XMLOutputFactory.newInstance();
            XMLStreamWriter wrtr = ofact.createXMLStreamWriter(bos, "UTF-8");
            mctx.setXmlWriter(new StAXWriter(obf.getNamespaces(), wrtr));
            mctx.marshalDocument(obj);
        } catch (XMLStreamException e) {
            throw new JiBXException("Error creating writer", e);
        }
       
View Full Code Here

        {
            IMarshallingContext mctx = bfact.createMarshallingContext();

            XMLStreamWriter noCloseWriter = new NoCloseXMLStreamWriter(((ElementWriter) writer)
                    .getXMLStreamWriter());
            mctx.setXmlWriter(new StAXWriter(bfact.getNamespaces(), noCloseWriter));

            mctx.marshalDocument(object);
        }
        catch (JiBXException e)
        {
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.axiom.om.OMDataSource#serialize(javax.xml.stream.XMLStreamWriter)
     */
    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
        try {
            IXMLWriter writer = new StAXWriter(bindingFactory.getNamespaces(),
                xmlWriter);
            IMarshallingContext ctx = bindingFactory.createMarshallingContext();
            ctx.setXmlWriter(writer);
            marshal(ctx);
        } catch (JiBXException e) {
View Full Code Here

            }
        } else {
            try {
                IBindingFactory factory = BindingDirectory.getFactory(obj.getClass());
                IMarshallingContext ctx = getMarshallingContext(obj);
                StAXWriter writer = new StAXWriter(factory.getNamespaces(), output);
                ctx.setXmlWriter(writer);
                ((IMarshallable)obj).marshal(ctx);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
View Full Code Here

                    }
                }
            }
           
            // marshal with all namespace declarations, since external state unknown
            IXMLWriter writer = new StAXWriter(nss, xmlWriter);
            IMarshallingContext ctx = bindingFactory.createMarshallingContext();
            ctx.setXmlWriter(writer);
            marshal(full, ctx);
           
        } catch (JiBXException e) {
View Full Code Here

  @Override
  protected void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException {
    try {
      MarshallingContext marshallingContext = (MarshallingContext) createMarshallingContext();
      IXMLWriter xmlWriter = new StAXWriter(marshallingContext.getNamespaces(), streamWriter);
      marshallingContext.setXmlWriter(xmlWriter);
      marshallingContext.marshalDocument(graph);
    }
    catch (JiBXException ex) {
      throw convertJibxException(ex, false);
View Full Code Here

            }
        } else {
            try {
                IBindingFactory factory = BindingDirectory.getFactory(obj.getClass());
                IMarshallingContext ctx = getMarshallingContext(obj);
                StAXWriter writer = new StAXWriter(factory.getNamespaces(), output);
                ctx.setXmlWriter(writer);
                ((IMarshallable)obj).marshal(ctx);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
View Full Code Here

                    }
                }
            }
           
            // marshal with all namespace declarations, since external state unknown
            IXMLWriter writer = new StAXWriter(nss, xmlWriter);
            IMarshallingContext ctx = bindingFactory.createMarshallingContext();
            ctx.setXmlWriter(writer);
            marshal(full, ctx);
           
        } catch (JiBXException e) {
View Full Code Here

TOP

Related Classes of org.jibx.runtime.impl.StAXWriter

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.