Package org.jibx.runtime

Examples of org.jibx.runtime.IMarshallingContext


            else
            {
               throw new RuntimeException(cause);
            }
         }
         IMarshallingContext mctx = bfact.createMarshallingContext();

         mctx.marshalDocument(newRepositoryServiceConfiguration, "ISO-8859-1", null, saveStream);
         saveStream.close();

         writer.writeStartElement("original-workspace-config");
         writer.writeCharacters(config.getName());
         writer.writeEndElement();
View Full Code Here


            else
            {
               throw new RuntimeException(cause);
            }
         }
         IMarshallingContext mctx = bfact.createMarshallingContext();
     
         mctx.marshalDocument(newRepositoryServiceConfiguration, "ISO-8859-1", null, saveStream);
         saveStream.close();
     
         writer.writeStartElement("original-repository-config");
         writer.writeCharacters(config.getName());
         writer.writeEndElement();
View Full Code Here

   {
      StringWriter sw = new StringWriter();
      try
      {
         IBindingFactory bfact = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
         IMarshallingContext mctx = bfact.createMarshallingContext();
         mctx.setIndent(2);
         mctx.marshalDocument(this, "UTF-8", null, sw);
      }
      catch (JiBXException e)
      {
         LOG.warn("Cannot convert the configuration to XML format", e);
         return null;
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.axiom.om.OMDataSource#serialize(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat)
     */
    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
        try {
            IMarshallingContext ctx = bindingFactory.createMarshallingContext();
            ctx.setOutput(output, format.getCharSetEncoding());
            marshal(ctx);
        } catch (JiBXException e) {
            throw new XMLStreamException("Error in JiBX marshalling", e);
        }
    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.axiom.om.OMDataSource#serialize(java.io.Writer, org.apache.axiom.om.OMOutputFormat)
     */
    public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
        try {
            IMarshallingContext ctx = bindingFactory.createMarshallingContext();
            ctx.setOutput(writer);
            marshal(ctx);
        } catch (JiBXException e) {
            throw new XMLStreamException("Error in JiBX marshalling", e);
        }
    }
View Full Code Here

     */
    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) {
            throw new XMLStreamException("Error in JiBX marshalling", e);
        }
    }
View Full Code Here

public class JibxDataWriter implements DataWriter<XMLStreamWriter> {

    public void write(Object obj, XMLStreamWriter output) {
        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

                throw new RuntimeException(e);
            }
        } 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

  @Override
  protected void marshalOutputStream(Object graph, OutputStream outputStream)
      throws XmlMappingException, IOException {
    try {
      IMarshallingContext marshallingContext = createMarshallingContext();
      marshallingContext.startDocument(this.encoding, this.standalone, outputStream);
      marshalDocument(marshallingContext, graph);
    }
    catch (JiBXException ex) {
      throw convertJibxException(ex, true);
    }
View Full Code Here

  }

  @Override
  protected void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException {
    try {
      IMarshallingContext marshallingContext = createMarshallingContext();
      marshallingContext.startDocument(this.encoding, this.standalone, writer);
      marshalDocument(marshallingContext, graph);
    }
    catch (JiBXException ex) {
      throw convertJibxException(ex, true);
    }
View Full Code Here

TOP

Related Classes of org.jibx.runtime.IMarshallingContext

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.