code: protected String getInputEncoding(Node nodeArg)  {
          Document doc = null;
          
          // Determine the Input Encoding of the document
          if (nodeArg != null) {
              if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) {
                  // The Document node is the Node argument
                  doc = (Document)nodeArg;
              } else { 
                  // 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.getInputEncoding();
              }
          } 
          // The default encoding returned is null
          return null;
      }
docs: Determines the Input Encoding of the Document Node to serialize.  If the Document Node
  is not a DOM Level 3 Node, then null is returned.
  
  @param  nodeArg The Node to serialize
  @return A String containing the input encoding.