Search in sources :

Example 11 with StreamException

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

the class ContentHandlerXmlHandler method endElement.

public void endElement() throws StreamException {
    try {
        String elementQName = elementNameStack.pop();
        String elementLocalName = elementNameStack.pop();
        String elementURI = elementNameStack.pop();
        contentHandler.endElement(elementURI, elementLocalName, elementQName);
        for (int i = bindings - 1; i >= scopeStack[depth - 1]; i--) {
            contentHandler.endPrefixMapping(prefixStack[i]);
        }
        bindings = scopeStack[--depth];
    } catch (SAXException ex) {
        throw new StreamException(ex);
    }
}
Also used : SAXException(org.xml.sax.SAXException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 12 with StreamException

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

the class SAXReader method proceed.

@Override
public boolean proceed() throws StreamException {
    XMLReader reader = source.getXMLReader();
    XmlHandlerContentHandler contentHandler = new XmlHandlerContentHandler(handler, expandEntityReferences);
    reader.setContentHandler(contentHandler);
    reader.setDTDHandler(contentHandler);
    try {
        reader.setProperty("http://xml.org/sax/properties/lexical-handler", contentHandler);
    } catch (SAXException ex) {
    // Ignore
    }
    try {
        reader.setProperty("http://xml.org/sax/properties/declaration-handler", contentHandler);
    } catch (SAXException ex) {
    // Ignore
    }
    try {
        reader.parse(source.getInputSource());
    } catch (IOException ex) {
        throw new StreamException(ex);
    } catch (SAXException ex) {
        throw new StreamException(ex);
    }
    return true;
}
Also used : IOException(java.io.IOException) XMLReader(org.xml.sax.XMLReader) SAXException(org.xml.sax.SAXException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 13 with StreamException

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

the class Serializer method attributeDecl.

/**
     * Report an attribute type declaration.
     *
     * <p>Only the effective (first) declaration for an attribute will
     * be reported.  The type will be one of the strings "CDATA",
     * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
     * "ENTITIES", or "NOTATION", or a parenthesized token group with
     * the separator "|" and all whitespace removed.</p>
     *
     * @param eName The name of the associated element.
     * @param aName The name of the attribute.
     * @param type A string representing the attribute type.
     * @param valueDefault A string representing the attribute default
     *        ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
     *        none of these applies.
     * @param value A string representing the attribute's default value,
     *        or null if there is none.
     * @exception StreamException The application may raise an exception.
     */
public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws StreamException {
    try {
        DTDprolog();
        writer.write("<!ATTLIST ");
        writer.write(eName);
        writer.write(' ');
        writer.write(aName);
        writer.write(' ');
        writer.write(type);
        if (valueDefault != null) {
            writer.write(' ');
            writer.write(valueDefault);
        }
        //writer.write(" ");
        //writer.write(value);
        writer.write(">\n");
    } catch (IOException ex) {
        throw new StreamException(ex);
    }
}
Also used : IOException(java.io.IOException) StreamException(org.apache.axiom.core.stream.StreamException)

Example 14 with StreamException

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

the class Serializer method unparsedEntityDecl.

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

Example 15 with StreamException

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

the class Serializer method startCDATASection.

@Override
public void startCDATASection() throws StreamException {
    closeStartTag();
    try {
        writer.write("<![CDATA[");
    } catch (IOException ex) {
        throw new StreamException(ex);
    }
    switchContext(CDATA_SECTION);
}
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