Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Document;

import org.w3c.dom.Node;

public class Main {
    /**
     * to get node's owner document
     *
     * @return The document that contain node
     */
    public static Document getOwnerDocument(Node node) {
        Document doc = null;
        if (node.getNodeType() == Node.DOCUMENT_NODE) {
            doc = (Document) node;
        } else {
            doc = node.getOwnerDocument();
        }
        return doc;
    }
}