private void iterativeParseElement (Element elem, HashMap<String, String> hmap) {
        String tagName = elem.getNodeName();
        NodeList children = elem.getChildNodes();

        for (int i = 0; i < children.getLength(); i++) {
            Node node = children.item(i);
            short nodeType = node.getNodeType();

            if (nodeType == Node.ELEMENT_NODE) {
                iterativeParseElement((Element)node, hmap);
            }
            else if (nodeType == Node.TEXT_NODE) {
                hmap.put(tagName, node.getNodeValue());
            }
        }
    }