Search in sources :

Example 21 with StreamException

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

the class Serializer method startElement.

@Override
public void startElement(String namespaceURI, String localName, String prefix) throws StreamException {
    closeStartTag();
    try {
        switchContext(TAG);
        writer.write('<');
        if (!prefix.isEmpty()) {
            writer.write(prefix);
            writer.write(':');
        }
        writer.write(localName);
    } catch (IOException e) {
        throw new StreamException(e);
    }
    if (2 * (depth + 1) > elementNameStack.length) {
        String[] newElementNameStack = new String[elementNameStack.length * 2];
        System.arraycopy(elementNameStack, 0, newElementNameStack, 0, elementNameStack.length);
        elementNameStack = newElementNameStack;
    }
    elementNameStack[2 * depth] = prefix;
    elementNameStack[2 * depth + 1] = localName;
    depth++;
    startTagOpen = true;
}
Also used : IOException(java.io.IOException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 22 with StreamException

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

the class Serializer method processEntityReference.

@Override
public void processEntityReference(String name, String replacementText) throws StreamException {
    closeStartTag();
    try {
        writer.write('&');
        writer.write(name);
        writer.write(';');
    } catch (IOException ex) {
        throw new StreamException(ex);
    }
}
Also used : IOException(java.io.IOException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 23 with StreamException

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

the class Serializer method writeRaw.

public void writeRaw(String s, UnmappableCharacterHandler unmappableCharacterHandler) throws StreamException {
    try {
        writer.setUnmappableCharacterHandler(unmappableCharacterHandler);
        writer.write(s);
        writer.setUnmappableCharacterHandler(unmappableCharacterHandlers[context]);
    } catch (IOException ex) {
        throw new StreamException(ex);
    }
}
Also used : IOException(java.io.IOException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 24 with StreamException

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

the class Serializer method notationDecl.

public void notationDecl(String name, String pubID, String sysID) throws StreamException {
    try {
        DTDprolog();
        writer.write("<!NOTATION ");
        writer.write(name);
        if (pubID != null) {
            writer.write(" PUBLIC \"");
            writer.write(pubID);
        } else {
            writer.write(" SYSTEM \"");
            writer.write(sysID);
        }
        writer.write("\" >\n");
    } catch (IOException ex) {
        throw new StreamException(ex);
    }
}
Also used : IOException(java.io.IOException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 25 with StreamException

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

the class Serializer method startProcessingInstruction.

@Override
public void startProcessingInstruction(String target) throws StreamException {
    closeStartTag();
    switchContext(TAG);
    try {
        writer.write("<?");
        writer.write(target);
        writer.write(' ');
    } catch (IOException ex) {
        throw new StreamException(ex);
    }
    switchContext(PROCESSING_INSTRUCTION);
}
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