Java tutorial
//package com.java2s; import org.w3c.dom.*; public class Main { /** * Method to convert a Node XML to a Element XML. * @param node node XML to input. * @return elment XML. */ public static Element convertNodeToElement(Node node) { NodeList list = node.getChildNodes(); Element m = null; for (int i = 0; i < list.getLength(); i++) { Node n = list.item(i); //Node n = elem.getFirstChild(); if (n.getNodeType() == Node.ELEMENT_NODE) { m = (Element) n; } } return m; } }