Code example for Node

Methods: getNodeType, getUserData

     * @param xmlNode Any node from a document returned by {@link #parseDocument(File, ISdkLog)}. 
     * @return The {@link File} object used to create the document or null. 
    static File extractXmlFilename(@Nullable Node xmlNode) {
        if (xmlNode != null && xmlNode.getNodeType() != Node.DOCUMENT_NODE) {
            xmlNode = xmlNode.getOwnerDocument();
        if (xmlNode != null) {
            Object data = xmlNode.getUserData(DATA_ORIGIN_FILE);
            if (data instanceof File) {
                return (File) data;
        return null; 
     * This is a CRUDE INEXACT HACK to decorate the DOM with some kind of line number 
     * information for elements. It's inexact because by the time we get the DOM we