Code example for Document

Methods: getImplementation, getXmlVersion

                // The Document node is the Node argument's ownerDocument 
                doc = nodeArg.getOwnerDocument();
            // Determine the DOM Version. 
            if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) {
                return doc.getXmlVersion();
        // The version will be treated as "1.0" which may result in 
        // an ill-formed document being serialized. 
        // If nodeArg does not have an ownerDocument, treat this as XML 1.0 
        return "1.0"; 
     * Determines the XML Encoding of the Document Node to serialize.  If the Document Node 
     * is not a DOM Level 3 Node, then the default encoding "UTF-8" is returned. 
     * @param  nodeArg The Node to serialize 
     * @return A String containing the encoding pseudo-attribute of the XMLDecl.