get Document from XML Node - Java XML

Java examples for XML:DOM Node Value

Description

get Document from XML Node

Demo Code


//package com.java2s;

import org.w3c.dom.Document;

import org.w3c.dom.Node;

public class Main {
    private static Document getDoc(Node n) {
        if (n instanceof Document)
            return (Document) n;
        else//from   w w  w  .j  a v a2s.c  om
            return n.getOwnerDocument();
    }
}

Related Tutorials