private Map<String, Object> getParams(Element paramsElement) {
		LinkedHashMap<String, Object> params = new LinkedHashMap<String, Object>();
		if (paramsElement == null) {
			return params;
		}
		NodeList childNodes = paramsElement.getChildNodes();
		for (int i = 0; i < childNodes.getLength(); i++) {
			Node childNode = childNodes.item(i);
			if ((childNode.getNodeType() == Node.ELEMENT_NODE) && "param".equals(childNode.getNodeName())) {
				Element paramElement = (Element) childNode;
				String paramName = paramElement.getAttribute("name");
				String val = getContent(paramElement);
				if (val.length() > 0) {
					char startChar = val.charAt(0);
					char endChar = val.charAt(val.length() - 1);
					if (startChar == '{' && endChar == '}') {
						try {
							JSONObject o = JSON.parseObject(val);
							params.put(paramName, o);
						} catch (JSONException e) {
							params.put(paramName, val);
						}
					} else if (startChar == '[' && endChar == ']') {
						try {
							JSONArray array = JSON.parseArray(val);
							params.put(paramName, array);
						} catch (JSONException e) {
							params.put(paramName, val);
						}
					} else {
						params.put(paramName, val);
					}
				}
			}
		}
		return params;
	}
private Map < String , Object > getParams ( Element paramsElement ) { LinkedHashMap < String , Object > params = new LinkedHashMap < String , Object > ( ) ; if ( paramsElement == null ) { return params ; } NodeList childNodes = paramsElement . getChildNodes ( ) ; for ( int i = 0 ; i < childNodes . getLength ( ) ; i ++ ) { Node childNode = childNodes . item ( i ) ; if ( ( childNode . getNodeType ( ) == Node . ELEMENT_NODE ) && "param" . equals ( childNode . getNodeName ( ) ) ) { Element paramElement = ( Element ) childNode ; String paramName = paramElement . getAttribute ( "name" ) ; String val = getContent ( paramElement ) ; if ( val . length ( ) > 0 ) { char startChar = val . charAt ( 0 ) ; char endChar = val . charAt ( val . length ( ) - 1 ) ; if ( startChar == '{' && endChar == '}' ) { try { JSONObject o = JSON . parseObject ( val ) ; params . put ( paramName , o ) ; } catch ( JSONException e ) { params . put ( paramName , val ) ; } } else if ( startChar == '[' && endChar == ']' ) { try { JSONArray array = JSON . parseArray ( val ) ; params . put ( paramName , array ) ; } catch ( JSONException e ) { params . put ( paramName , val ) ; } } else { params . put ( paramName , val ) ; } } } } return params ; }
This method will find all the parameters under this
<code>paramsElement</code> and return them as Map<String, String>. For
example,

<pre>
<result ... >
<param name="param1">value1</param>
<param name="param2">value2</param>
<param name="param3">value3</param>
</result>
</pre>

will returns a Map<String, String> with the following key, value pairs :-
<ul>
<li>param1 - value1</li>
<li>param2 - value2</li>
<li>param3 - value3</li>
</ul>

@param paramsElement
@return