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
,ContentHandler
A SAX parser for an
XmlRpcServer
's
response.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Throwable
private int
private String
private boolean
private int
Fields inherited from class org.apache.xmlrpc.parser.RecursiveTypeParserImpl
cfg
-
Constructor Summary
ConstructorsConstructorDescriptionXmlRpcResponseParser
(XmlRpcStreamRequestConfig pConfig, TypeFactory pTypeFactory) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
endElement
(String pURI, String pLocalName, String pQName) If the response contained a fault, returns the (optional) exception.int
If the response contained a fault, returns the error code.If the response contained a fault, returns the error message.boolean
Returns whether the response returned success.void
void
startElement
(String pURI, String pLocalName, String pQName, 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
level
private int level -
isSuccess
private boolean isSuccess -
errorCode
private int errorCode -
errorMessage
-
errorCause
-
-
Constructor Details
-
XmlRpcResponseParser
Creates a new instance.- Parameters:
pConfig
- The response configuration.pTypeFactory
- The type factory for creating instances ofTypeParser
.
-
-
Method Details
-
addResult
- Specified by:
addResult
in classRecursiveTypeParserImpl
- Throws:
SAXException
-
startDocument
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classRecursiveTypeParserImpl
- Throws:
SAXException
-
startElement
public void startElement(String pURI, String pLocalName, String pQName, Attributes pAttrs) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classRecursiveTypeParserImpl
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classRecursiveTypeParserImpl
- Throws:
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
If the response contained a fault, returns the error message.- Returns:
- The error message.
-
getErrorCause
If the response contained a fault, returns the (optional) exception.
-