Package org.apache.xmlrpc.parser
Class XmlRpcResponseParser
- java.lang.Object
-
- org.apache.xmlrpc.parser.TypeParserImpl
-
- org.apache.xmlrpc.parser.RecursiveTypeParserImpl
-
- org.apache.xmlrpc.parser.XmlRpcResponseParser
-
- All Implemented Interfaces:
TypeParser,org.xml.sax.ContentHandler
public class XmlRpcResponseParser extends RecursiveTypeParserImpl
A SAX parser for anXmlRpcServer's response.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ThrowableerrorCauseprivate interrorCodeprivate java.lang.StringerrorMessageprivate booleanisSuccessprivate intlevel-
Fields inherited from class org.apache.xmlrpc.parser.RecursiveTypeParserImpl
cfg
-
-
Constructor Summary
Constructors Constructor Description XmlRpcResponseParser(XmlRpcStreamRequestConfig pConfig, TypeFactory pTypeFactory)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddResult(java.lang.Object pResult)voidendElement(java.lang.String pURI, java.lang.String pLocalName, java.lang.String pQName)java.lang.ThrowablegetErrorCause()If the response contained a fault, returns the (optional) exception.intgetErrorCode()If the response contained a fault, returns the error code.java.lang.StringgetErrorMessage()If the response contained a fault, returns the error message.booleanisSuccess()Returns whether the response returned success.voidstartDocument()voidstartElement(java.lang.String pURI, java.lang.String pLocalName, java.lang.String pQName, org.xml.sax.Attributes pAttrs)-
Methods inherited from class org.apache.xmlrpc.parser.RecursiveTypeParserImpl
characters, endPrefixMapping, endValueTag, ignorableWhitespace, processingInstruction, skippedEntity, startPrefixMapping, startValueTag
-
Methods inherited from class org.apache.xmlrpc.parser.TypeParserImpl
endDocument, getDocumentLocator, getResult, isEmpty, setDocumentLocator, setResult
-
-
-
-
Constructor Detail
-
XmlRpcResponseParser
public XmlRpcResponseParser(XmlRpcStreamRequestConfig pConfig, TypeFactory pTypeFactory)
Creates a new instance.- Parameters:
pConfig- The response configuration.pTypeFactory- The type factory for creating instances ofTypeParser.
-
-
Method Detail
-
addResult
protected void addResult(java.lang.Object pResult) throws org.xml.sax.SAXException- Specified by:
addResultin classRecursiveTypeParserImpl- Throws:
org.xml.sax.SAXException
-
startDocument
public void startDocument() throws org.xml.sax.SAXException- Specified by:
startDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
startDocumentin classRecursiveTypeParserImpl- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String pURI, java.lang.String pLocalName, java.lang.String pQName, org.xml.sax.Attributes pAttrs) throws org.xml.sax.SAXException- Specified by:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin classRecursiveTypeParserImpl- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String pURI, java.lang.String pLocalName, java.lang.String pQName) throws org.xml.sax.SAXException- Specified by:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin classRecursiveTypeParserImpl- Throws:
org.xml.sax.SAXException
-
isSuccess
public boolean isSuccess()
Returns whether the response returned success. If so, the result object may be fetched usingTypeParserImpl.getResult(). Otherwise, you may use the methodsgetErrorCode()andgetErrorMessage()to check for error reasons.- Returns:
- True, if the response indicated success, false otherwise.
-
getErrorCode
public int getErrorCode()
If the response contained a fault, returns the error code.- Returns:
- The numeric error code.
-
getErrorMessage
public java.lang.String getErrorMessage()
If the response contained a fault, returns the error message.- Returns:
- The error message.
-
getErrorCause
public java.lang.Throwable getErrorCause()
If the response contained a fault, returns the (optional) exception.
-
-