Here you can find the source of parseXMLDoc(Element element, Document doc, Map
public static void parseXMLDoc(Element element, Document doc, Map<String, String> oauthResponse)
//package com.java2s; //License from project: Open Source License import java.util.Map; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static void parseXMLDoc(Element element, Document doc, Map<String, String> oauthResponse) { NodeList child = null;/*from w w w.j a v a2 s . co m*/ if (element == null) { child = doc.getChildNodes(); } else { child = element.getChildNodes(); } for (int j = 0; j < child.getLength(); j++) { if (child.item(j).getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) { org.w3c.dom.Element childElement = (org.w3c.dom.Element) child .item(j); if (childElement.hasChildNodes()) { System.out.println(childElement.getTagName() + " : " + childElement.getTextContent()); oauthResponse.put(childElement.getTagName(), childElement.getTextContent()); parseXMLDoc(childElement, null, oauthResponse); } } } } }