Java tutorial
//package com.java2s; //License from project: Open Source License import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.Node; public class Main { private static DOMImplementation getDocImplementation(Node node) { DOMImplementation domImpl; if (node.getNodeType() == Node.DOCUMENT_NODE) { domImpl = ((Document) node).getImplementation(); } else { domImpl = node.getOwnerDocument().getImplementation(); } return domImpl; } }