Search in sources :

Example 31 with StreamException

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

the class ContentHandlerXmlHandler method endProcessingInstruction.

@Override
public void endProcessingInstruction() throws StreamException {
    try {
        contentHandler.processingInstruction(piTarget, accumulator.toString());
        accumulator.clear();
        piTarget = null;
        characterDataMode = CharacterDataMode.PASS_THROUGH;
    } catch (SAXException ex) {
        throw new StreamException(ex);
    }
}
Also used : SAXException(org.xml.sax.SAXException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 32 with StreamException

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

the class Serializer method externalEntityDecl.

/**
     * Report a parsed external entity declaration.
     *
     * <p>Only the effective (first) declaration for each entity
     * will be reported.</p>
     *
     * @param name The name of the entity.  If it is a parameter
     *        entity, the name will begin with '%'.
     * @param publicId The declared public identifier of the entity, or
     *        null if none was declared.
     * @param systemId The declared system identifier of the entity.
     * @exception StreamException The application may raise an exception.
     * @see #internalEntityDecl
     * @see org.xml.sax.DTDHandler#unparsedEntityDecl
     */
public void externalEntityDecl(String name, String publicId, String systemId) throws StreamException {
    try {
        DTDprolog();
        writer.write("<!ENTITY ");
        writer.write(name);
        if (publicId != null) {
            writer.write(" PUBLIC \"");
            writer.write(publicId);
        } else {
            writer.write(" SYSTEM \"");
            writer.write(systemId);
        }
        writer.write("\" >\n");
    } catch (IOException ex) {
        throw new StreamException(ex);
    }
}
Also used : IOException(java.io.IOException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 33 with StreamException

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

the class Serializer method switchContext.

private void switchContext(int context) throws StreamException {
    this.context = context;
    try {
        writer.setUnmappableCharacterHandler(unmappableCharacterHandlers[context]);
    } catch (IOException ex) {
        throw new StreamException(ex);
    }
    matchedIllegalCharacters = 0;
    squareBrackets = 0;
}
Also used : IOException(java.io.IOException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 34 with StreamException

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

the class Serializer method writeInternalSubset.

public void writeInternalSubset(String internalSubset) throws StreamException {
    try {
        DTDprolog();
        writer.write(internalSubset);
    } catch (IOException ex) {
        throw new StreamException(ex);
    }
}
Also used : IOException(java.io.IOException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 35 with StreamException

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

the class Serializer method elementDecl.

/**
     *   Report an element type declaration.
     *  
     *   <p>The content model will consist of the string "EMPTY", the
     *   string "ANY", or a parenthesised group, optionally followed
     *   by an occurrence indicator.  The model will be normalized so
     *   that all whitespace is removed,and will include the enclosing
     *   parentheses.</p>
     *  
     *   @param name The element type name.
     *   @param model The content model as a normalized string.
     *   @exception StreamException The application may raise an exception.
     */
public void elementDecl(String name, String model) throws StreamException {
    try {
        DTDprolog();
        writer.write("<!ELEMENT ");
        writer.write(name);
        writer.write(' ');
        writer.write(model);
        writer.write(">\n");
    } catch (IOException ex) {
        throw new StreamException(ex);
    }
}
Also used : IOException(java.io.IOException) 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