Search in sources :

Example 26 with StreamException

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

the class XsiTypeFilterHandler method attributesCompleted.

@Override
public void attributesCompleted() throws StreamException {
    try {
        if (xsiType != null) {
            int idx = xsiType.indexOf(':');
            String prefix = idx == -1 ? "" : xsiType.substring(0, idx);
            boolean bound = false;
            for (int i = 0; i < prefixCount; i++) {
                if (prefixes[i] == prefix) {
                    bound = true;
                    break;
                }
            }
            if (!bound) {
                String namespaceURI = contextElement.coreLookupNamespaceURI(prefix, AxiomSemantics.INSTANCE);
                if (namespaceURI != null && !namespaceURI.isEmpty()) {
                    processNamespaceDeclaration(prefix, namespaceURI);
                }
            }
        }
    } catch (CoreModelException ex) {
        throw new StreamException(ex);
    }
    super.attributesCompleted();
    xsiType = null;
}
Also used : CoreModelException(org.apache.axiom.core.CoreModelException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 27 with StreamException

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

the class XMLStreamWriterHandler method endProcessingInstruction.

@Override
public void endProcessingInstruction() throws StreamException {
    try {
        writer.writeProcessingInstruction(piTarget + " ", stopBuffering());
        piTarget = null;
    } catch (XMLStreamException ex) {
        throw new StreamException(ex);
    }
}
Also used : XMLStreamException(javax.xml.stream.XMLStreamException) StreamException(org.apache.axiom.core.stream.StreamException) XMLStreamException(javax.xml.stream.XMLStreamException)

Example 28 with StreamException

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

the class XOPEncodingFilterHandler method processCharacterData.

@Override
protected String processCharacterData(Object data) throws StreamException {
    if (data instanceof TextContent) {
        TextContent textContent = (TextContent) data;
        if (textContent.isBinary()) {
            Object dataHandlerObject = textContent.getDataHandlerObject();
            boolean optimize;
            try {
                if (dataHandlerObject instanceof DataHandlerProvider) {
                    optimize = optimizationPolicy.isOptimized((DataHandlerProvider) dataHandlerObject, textContent.isOptimize());
                } else {
                    optimize = optimizationPolicy.isOptimized((DataHandler) dataHandlerObject, textContent.isOptimize());
                }
            } catch (IOException ex) {
                throw new StreamException(ex);
            }
            if (optimize) {
                String contentID = contentIDGenerator.generateContentID(textContent.getContentID());
                dataHandlerObjects.put(contentID, dataHandlerObject);
                return contentID;
            }
        }
    }
    return null;
}
Also used : DataHandlerProvider(org.apache.axiom.ext.stax.datahandler.DataHandlerProvider) DataHandler(javax.activation.DataHandler) IOException(java.io.IOException) TextContent(org.apache.axiom.om.impl.intf.TextContent) StreamException(org.apache.axiom.core.stream.StreamException)

Example 29 with StreamException

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

the class ContentHandlerXmlHandler method endComment.

@Override
public void endComment() throws StreamException {
    if (lexicalHandler != null) {
        try {
            lexicalHandler.comment(buffer, 0, bufferPos);
            bufferPos = 0;
        } catch (SAXException ex) {
            throw new StreamException(ex);
        }
    }
    characterDataMode = CharacterDataMode.PASS_THROUGH;
}
Also used : SAXException(org.xml.sax.SAXException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 30 with StreamException

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

the class ContentHandlerXmlHandler method processDocumentTypeDeclaration.

public void processDocumentTypeDeclaration(String rootName, String publicId, String systemId, String internalSubset) throws StreamException {
    if (lexicalHandler != null) {
        try {
            lexicalHandler.startDTD(rootName, publicId, systemId);
            lexicalHandler.endDTD();
        } catch (SAXException ex) {
            throw new StreamException(ex);
        }
    }
}
Also used : SAXException(org.xml.sax.SAXException) StreamException(org.apache.axiom.core.stream.StreamException)

Aggregations

StreamException (org.apache.axiom.core.stream.StreamException)38 IOException (java.io.IOException)23 SAXException (org.xml.sax.SAXException)9 XMLStreamException (javax.xml.stream.XMLStreamException)6 CoreModelException (org.apache.axiom.core.CoreModelException)3 XmlHandler (org.apache.axiom.core.stream.XmlHandler)3 CoreElement (org.apache.axiom.core.CoreElement)2 Serializer (org.apache.axiom.core.stream.serializer.Serializer)2 XmlDeclarationRewriterHandler (org.apache.axiom.om.impl.stream.XmlDeclarationRewriterHandler)2 OutputStream (java.io.OutputStream)1 StringWriter (java.io.StringWriter)1 DataHandler (javax.activation.DataHandler)1 NamespaceContext (javax.xml.namespace.NamespaceContext)1 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)1 CoreAttribute (org.apache.axiom.core.CoreAttribute)1 CoreNamespaceDeclaration (org.apache.axiom.core.CoreNamespaceDeclaration)1 CoreParentNode (org.apache.axiom.core.CoreParentNode)1 CharacterData (org.apache.axiom.core.stream.CharacterData)1 DocumentElementExtractingFilterHandler (org.apache.axiom.core.stream.DocumentElementExtractingFilterHandler)1 NamespaceRepairingFilterHandler (org.apache.axiom.core.stream.NamespaceRepairingFilterHandler)1