Search in sources :

Example 1 with JiBXException

use of org.jibx.runtime.JiBXException in project spring-framework by spring-projects.

the class JibxMarshaller method unmarshalXmlStreamReader.

@Override
protected Object unmarshalXmlStreamReader(XMLStreamReader streamReader) {
    try {
        UnmarshallingContext unmarshallingContext = (UnmarshallingContext) createUnmarshallingContext();
        IXMLReader xmlReader = new StAXReaderWrapper(streamReader, null, true);
        unmarshallingContext.setDocument(xmlReader);
        return unmarshallingContext.unmarshalElement();
    } catch (JiBXException ex) {
        throw convertJibxException(ex, false);
    }
}
Also used : IXMLReader(org.jibx.runtime.IXMLReader) StAXReaderWrapper(org.jibx.runtime.impl.StAXReaderWrapper) JiBXException(org.jibx.runtime.JiBXException) UnmarshallingContext(org.jibx.runtime.impl.UnmarshallingContext) IUnmarshallingContext(org.jibx.runtime.IUnmarshallingContext)

Example 2 with JiBXException

use of org.jibx.runtime.JiBXException in project spring-framework by spring-projects.

the class JibxMarshaller method marshalXmlStreamWriter.

@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);
    }
}
Also used : IXMLWriter(org.jibx.runtime.IXMLWriter) JiBXException(org.jibx.runtime.JiBXException) IMarshallingContext(org.jibx.runtime.IMarshallingContext) MarshallingContext(org.jibx.runtime.impl.MarshallingContext) StAXWriter(org.jibx.runtime.impl.StAXWriter)

Example 3 with JiBXException

use of org.jibx.runtime.JiBXException in project spring-framework by spring-projects.

the class JibxMarshaller method marshalOutputStream.

// Supported marshalling
@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);
    }
}
Also used : IMarshallingContext(org.jibx.runtime.IMarshallingContext) JiBXException(org.jibx.runtime.JiBXException)

Example 4 with JiBXException

use of org.jibx.runtime.JiBXException in project spring-framework by spring-projects.

the class JibxMarshaller method marshalWriter.

@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);
    }
}
Also used : IMarshallingContext(org.jibx.runtime.IMarshallingContext) JiBXException(org.jibx.runtime.JiBXException)

Aggregations

JiBXException (org.jibx.runtime.JiBXException)4 IMarshallingContext (org.jibx.runtime.IMarshallingContext)3 IUnmarshallingContext (org.jibx.runtime.IUnmarshallingContext)1 IXMLReader (org.jibx.runtime.IXMLReader)1 IXMLWriter (org.jibx.runtime.IXMLWriter)1 MarshallingContext (org.jibx.runtime.impl.MarshallingContext)1 StAXReaderWrapper (org.jibx.runtime.impl.StAXReaderWrapper)1 StAXWriter (org.jibx.runtime.impl.StAXWriter)1 UnmarshallingContext (org.jibx.runtime.impl.UnmarshallingContext)1