Code example for Element

Methods: getAttributes

0
		 
		return getAttribute("transaction_id"); 
	} 
 
	public boolean hasAttribute(String attr) {
		return parsedResponse.getAttributes().getNamedItem(attr) != null;
	} 
 
	public String getAttribute(String attr) {
		Node item = parsedResponse.getAttributes().getNamedItem(attr);
		 
		if (item == null)
			return null; //raise error? 
		 
		return item.getNodeValue();
	} 
 
	public String getText() {
		Node node = parsedResponse.getFirstChild();
		if (node.getNodeType() == Node.TEXT_NODE) 
			return ((Text) node).getData();