Search in sources :

Example 1 with Serializer

use of org.apache.axiom.core.stream.serializer.Serializer in project webservices-axiom by apache.

the class MTOMXMLStreamWriterImpl method getOutputStream.

@Override
public OutputStream getOutputStream() throws XMLStreamException {
    OutputStream outputStream;
    XmlHandler handler = getHandler();
    // Remove wrappers that can be safely removed
    while (handler instanceof DocumentElementExtractingFilterHandler || handler instanceof NamespaceRepairingFilterHandler || handler instanceof XsiTypeFilterHandler || handler instanceof XmlDeclarationRewriterHandler || handler instanceof XOPEncodingFilterHandler) {
        handler = ((XmlHandlerWrapper) handler).getParent();
    }
    if (handler instanceof Serializer) {
        try {
            outputStream = ((Serializer) handler).getOutputStream();
        } catch (StreamException ex) {
            throw new XMLStreamException(ex);
        }
    } else {
        outputStream = null;
    }
    if (log.isDebugEnabled()) {
        if (outputStream == null) {
            log.debug("Direct access to the output stream is not available.");
        } else {
            log.debug("Returning access to the output stream: " + outputStream);
        }
    }
    return outputStream;
}
Also used : NamespaceRepairingFilterHandler(org.apache.axiom.core.stream.NamespaceRepairingFilterHandler) XMLStreamException(javax.xml.stream.XMLStreamException) XmlHandler(org.apache.axiom.core.stream.XmlHandler) DocumentElementExtractingFilterHandler(org.apache.axiom.core.stream.DocumentElementExtractingFilterHandler) XsiTypeFilterHandler(org.apache.axiom.om.impl.stream.XsiTypeFilterHandler) OutputStream(java.io.OutputStream) XmlDeclarationRewriterHandler(org.apache.axiom.om.impl.stream.XmlDeclarationRewriterHandler) XOPEncodingFilterHandler(org.apache.axiom.om.impl.stream.xop.XOPEncodingFilterHandler) Serializer(org.apache.axiom.core.stream.serializer.Serializer) StreamException(org.apache.axiom.core.stream.StreamException) XMLStreamException(javax.xml.stream.XMLStreamException)

Example 2 with Serializer

use of org.apache.axiom.core.stream.serializer.Serializer in project webservices-axiom by apache.

the class XMLStreamWriterHandler method processDocumentTypeDeclaration.

@Override
public void processDocumentTypeDeclaration(String rootName, String publicId, String systemId, String internalSubset) throws StreamException {
    StringWriter sw = new StringWriter();
    Serializer serializer = new Serializer(sw);
    serializer.startFragment();
    serializer.processDocumentTypeDeclaration(rootName, publicId, systemId, internalSubset);
    serializer.completed();
    try {
        writer.writeDTD(sw.toString());
    } catch (XMLStreamException ex) {
        throw new StreamException(ex);
    }
}
Also used : StringWriter(java.io.StringWriter) XMLStreamException(javax.xml.stream.XMLStreamException) Serializer(org.apache.axiom.core.stream.serializer.Serializer) StreamException(org.apache.axiom.core.stream.StreamException) XMLStreamException(javax.xml.stream.XMLStreamException)

Example 3 with Serializer

use of org.apache.axiom.core.stream.serializer.Serializer in project webservices-axiom by apache.

the class XmlHandlerContentHandler method startDTD.

public void startDTD(String name, String publicId, String systemId) throws SAXException {
    dtdName = name;
    dtdPublicId = publicId;
    dtdSystemId = systemId;
    internalSubset = new StringWriter();
    internalSubsetSerializer = new Serializer(internalSubset);
}
Also used : StringWriter(java.io.StringWriter) Serializer(org.apache.axiom.core.stream.serializer.Serializer)

Aggregations

Serializer (org.apache.axiom.core.stream.serializer.Serializer)3 StringWriter (java.io.StringWriter)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 StreamException (org.apache.axiom.core.stream.StreamException)2 OutputStream (java.io.OutputStream)1 DocumentElementExtractingFilterHandler (org.apache.axiom.core.stream.DocumentElementExtractingFilterHandler)1 NamespaceRepairingFilterHandler (org.apache.axiom.core.stream.NamespaceRepairingFilterHandler)1 XmlHandler (org.apache.axiom.core.stream.XmlHandler)1 XmlDeclarationRewriterHandler (org.apache.axiom.om.impl.stream.XmlDeclarationRewriterHandler)1 XsiTypeFilterHandler (org.apache.axiom.om.impl.stream.XsiTypeFilterHandler)1 XOPEncodingFilterHandler (org.apache.axiom.om.impl.stream.xop.XOPEncodingFilterHandler)1