com.plumtree.portaluiinfrastructure.restconsumerframework
Class RestXMLResponse

java.lang.Object
  extended by com.plumtree.portaluiinfrastructure.restconsumerframework.RestXMLResponse
All Implemented Interfaces:
IRestResponse

public class RestXMLResponse
extends java.lang.Object
implements IRestResponse

Helper class to process responses containing XML

Author:
rozhang

Field Summary
protected  XPDocument m_doc
           
protected  boolean m_notoplevelnodes
           
protected  java.lang.String m_toplevelnodenames
           
 
Constructor Summary
RestXMLResponse(IOKHttpResponse response)
           
 
Method Summary
protected  XPHashtable ExtractNodeChildData(XPNode topnode)
          Fills a hashtable with the child node names and node body text of the provided node.
 java.lang.String GetListName()
          Returns the name of a node list under the root node.
protected  java.lang.String GetNodeTextBody(XPNode node)
          Helper method to get the text value in a node
 XPArrayList GetResponseList()
          Exclusive from GetSingleDataItem method, only one is valid in any one response
 java.lang.String GetRootElementName()
          Gets the name of the top level element
protected  XPElement GetRootNode()
          INTERNAL METHODS
 java.lang.String GetRootNodeName()
          Gets the element name of the root element.
 XPHashtable GetSingleDataItem()
          Exclusive from GetResponseList method, only one is valid in any one response
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_doc

protected XPDocument m_doc

m_toplevelnodenames

protected java.lang.String m_toplevelnodenames

m_notoplevelnodes

protected boolean m_notoplevelnodes
Constructor Detail

RestXMLResponse

public RestXMLResponse(IOKHttpResponse response)
Parameters:
response -
Method Detail

GetRootElementName

public java.lang.String GetRootElementName()
Gets the name of the top level element

Specified by:
GetRootElementName in interface IRestResponse
Returns:

GetListName

public java.lang.String GetListName()
Returns the name of a node list under the root node. All the nodes under the root node has to share the same name to be considered a valid node list.

Specified by:
GetListName in interface IRestResponse
Returns:
null if the response content doesn't contain a list

GetSingleDataItem

public XPHashtable GetSingleDataItem()
Exclusive from GetResponseList method, only one is valid in any one response

Specified by:
GetSingleDataItem in interface IRestResponse
Returns:
null if the response is actually a list of items

GetRootNodeName

public java.lang.String GetRootNodeName()
Gets the element name of the root element.

Returns:

GetResponseList

public XPArrayList GetResponseList()
Exclusive from GetSingleDataItem method, only one is valid in any one response

Specified by:
GetResponseList in interface IRestResponse
Returns:
null if the current response does not contain a top level list, XPArrayList contains XPHashtables

GetRootNode

protected XPElement GetRootNode()
INTERNAL METHODS


GetNodeTextBody

protected java.lang.String GetNodeTextBody(XPNode node)
Helper method to get the text value in a node

Parameters:
node -
Returns:

ExtractNodeChildData

protected XPHashtable ExtractNodeChildData(XPNode topnode)
Fills a hashtable with the child node names and node body text of the provided node. Multiple child nodes with the same names are inserted into the same hash key, and the multiple values are added to an XPArrayList Nested child nodes are inserted as nested XPHashTable

Parameters:
topnode -
Returns:
null if the provided node is null or does not have any child nodes.



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.