Java examples for XML:DOM Node
Convert Node to XML Element
import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main{ public static Element toElement(Node node) throws XMLHelperException { if (node.getNodeType() != Node.ELEMENT_NODE) throw new XMLHelperException("\"" + node.getNodeName() + "\" must be an element node"); return (Element) node; }//from w ww .j av a2 s.c o m }