Example usage for org.xml.sax SAXException SAXException

List of usage examples for org.xml.sax SAXException SAXException

Introduction

In this page you can find the example usage for org.xml.sax SAXException SAXException.

Prototype

public SAXException(Exception e) 

Source Link

Document

Create a new SAXException wrapping an existing exception.

Usage

From source file:org.apache.axis.message.SAXOutputter.java

public void startElement(String namespace, String localName, String qName, Attributes attributes)
        throws SAXException {
    if (log.isDebugEnabled()) {
        log.debug("SAXOutputter.startElement ['" + namespace + "' " + localName + "]");
    }/* ww w . j a  v a  2s.  c o m*/

    try {
        context.startElement(new QName(namespace, localName), attributes);
    } catch (IOException e) {
        throw new SAXException(e);
    }
}

From source file:org.apache.axis.message.SAXOutputter.java

public void endElement(String namespace, String localName, String qName) throws SAXException {
    if (log.isDebugEnabled()) {
        log.debug("SAXOutputter.endElement ['" + namespace + "' " + localName + "]");
    }/*from w  w  w .  j av a2 s. c o  m*/

    try {
        context.endElement();
    } catch (IOException e) {
        throw new SAXException(e);
    }
}

From source file:org.apache.axis.message.SAXOutputter.java

public void startCDATA() throws SAXException {
    try {/*from   w  ww. ja  v  a 2s.  co  m*/
        isCDATA = true;
        context.writeString("<![CDATA[");
    } catch (IOException e) {
        throw new SAXException(e);
    }
}

From source file:org.apache.axis.message.SAXOutputter.java

public void endCDATA() throws SAXException {
    try {//from   w w w .  j a  v  a2s.  c o m
        isCDATA = false;
        context.writeString("]]>");
    } catch (IOException e) {
        throw new SAXException(e);
    }
}

From source file:org.apache.axis.message.SAXOutputter.java

public void comment(char[] ch, int start, int length) throws SAXException {
    if (log.isDebugEnabled()) {
        log.debug("SAXOutputter.comment ['" + new String(ch, start, length) + "']");
    }/*  w w  w  .j  av  a 2 s .co m*/
    try {
        context.writeString("<!--");
        context.writeChars(ch, start, length);
        context.writeString("-->");
    } catch (IOException e) {
        throw new SAXException(e);
    }
}

From source file:org.apache.axis.providers.java.RPCProvider.java

protected OperationDesc getOperationDesc(MessageContext msgContext, RPCElement body)
        throws SAXException, AxisFault {
    SOAPService service = msgContext.getService();
    ServiceDesc serviceDesc = service.getServiceDescription();
    String methodName = body.getMethodName();

    // FIXME (there should be a cleaner way to do this)
    OperationDesc operation = msgContext.getOperation();
    if (operation == null) {
        QName qname = new QName(body.getNamespaceURI(), body.getName());
        operation = serviceDesc.getOperationByElementQName(qname);

        if (operation == null) {
            SOAPConstants soapConstants = msgContext == null ? SOAPConstants.SOAP11_CONSTANTS
                    : msgContext.getSOAPConstants();
            if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
                AxisFault fault = new AxisFault(Constants.FAULT_SOAP12_SENDER,
                        Messages.getMessage("noSuchOperation", methodName), null, null);
                fault.addFaultSubCode(Constants.FAULT_SUBCODE_PROC_NOT_PRESENT);
                throw new SAXException(fault);
            } else {
                throw new AxisFault(Constants.FAULT_CLIENT, Messages.getMessage("noSuchOperation", methodName),
                        null, null);// w  ww  .  j  a v  a2 s .c om
            }
        } else {
            msgContext.setOperation(operation);
        }
    }
    return operation;
}

From source file:org.apache.cayenne.map.MapLoader.java

private void processStartDbRelationship(Attributes atts) throws SAXException {
    String name = atts.getValue("", "name");
    if (name == null) {
        throw new SAXException("MapLoader::processStartDbRelationship(),"
                + " Unable to parse name. Attributes:\n" + printAttributes(atts));
    }/*from   w ww. ja v  a2 s  .c o m*/

    String sourceName = atts.getValue("", "source");
    if (sourceName == null) {
        throw new SAXException("MapLoader::processStartDbRelationship() - null source entity");
    }

    DbEntity source = dataMap.getDbEntity(sourceName);
    if (source == null) {
        return;
    }

    String toManyString = atts.getValue("", "toMany");
    boolean toMany = toManyString != null && toManyString.equalsIgnoreCase(TRUE);

    String toDependPkString = atts.getValue("", "toDependentPK");
    boolean toDependentPK = toDependPkString != null && toDependPkString.equalsIgnoreCase(TRUE);

    dbRelationship = new DbRelationship(name);
    dbRelationship.setSourceEntity(source);
    dbRelationship.setTargetEntityName(atts.getValue("", "target"));
    dbRelationship.setToMany(toMany);
    dbRelationship.setToDependentPK(toDependentPK);

    source.addRelationship(dbRelationship);
}

From source file:org.apache.cayenne.map.MapLoader.java

private void processStartDbRelationshipRef(Attributes atts) throws SAXException {
    // db-relationship-ref element is deprecated and is supported for backwards
    // compatibility only

    String name = atts.getValue("", "name");
    if (name == null) {
        throw new SAXException("MapLoader::processStartDbRelationshipRef()" + ", Null DbRelationship name for "
                + objRelationship.getName());
    }//from   ww  w.ja  v a2 s.c  om

    String path = objRelationship.getDbRelationshipPath();
    path = (path != null) ? path + "." + name : name;
    objRelationship.setDbRelationshipPath(path);
}

From source file:org.apache.cayenne.map.MapLoader.java

private void processStartObjRelationship(Attributes atts) throws SAXException {
    String name = atts.getValue("", "name");
    if (null == name) {
        throw new SAXException("MapLoader::processStartObjRelationship(),"
                + " Unable to parse target. Attributes:\n" + printAttributes(atts));
    }//from   w ww .ja va 2 s  .  c  o m

    String collectionType = atts.getValue("", "collection-type");
    String mapKey = atts.getValue("", "map-key");

    String sourceName = atts.getValue("", "source");
    if (sourceName == null) {
        throw new SAXException("MapLoader::processStartObjRelationship(),"
                + " Unable to parse source. Attributes:\n" + printAttributes(atts));
    }

    ObjEntity source = dataMap.getObjEntity(sourceName);
    if (source == null) {
        throw new SAXException(
                "MapLoader::processStartObjRelationship()," + " Unable to find source " + sourceName);
    }

    String deleteRuleName = atts.getValue("", "deleteRule");
    int deleteRule = (deleteRuleName != null) ? DeleteRule.deleteRuleForName(deleteRuleName)
            : DeleteRule.NO_ACTION;

    objRelationship = new ObjRelationship(name);
    objRelationship.setSourceEntity(source);
    objRelationship.setTargetEntityName(atts.getValue("", "target"));
    objRelationship.setDeleteRule(deleteRule);
    objRelationship.setUsedForLocking(TRUE.equalsIgnoreCase(atts.getValue("", "lock")));
    objRelationship.setDeferredDbRelationshipPath((atts.getValue("", "db-relationship-path")));
    objRelationship.setCollectionType(collectionType);
    objRelationship.setMapKey(mapKey);
    source.addRelationship(objRelationship);
}

From source file:org.apache.cayenne.map.MapLoader.java

private void processStartProcedure(Attributes attributes) throws SAXException {

    String name = attributes.getValue("", "name");
    if (null == name) {
        throw new SAXException("MapLoader::processStartProcedure()," + " no procedure name.");
    }/* w w w  .  j  a  v a2  s  . co m*/

    String schema = attributes.getValue("", "schema");
    String catalog = attributes.getValue("", "catalog");
    String returningValue = attributes.getValue("", "returningValue");

    procedure = new Procedure(name);
    procedure.setReturningValue(returningValue != null && returningValue.equalsIgnoreCase(TRUE));
    procedure.setSchema(schema);
    procedure.setCatalog(catalog);
    dataMap.addProcedure(procedure);
}