Here you can find the source of getRootNode(Document document)
public static Node getRootNode(Document document)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node getRootNode(Document document) { NodeList nodeList = document.getChildNodes(); return nodeList.item(0); }/* ww w. j a va 2 s .co m*/ }