code: private void printDocument(Node node, Hashtable properties) {
  
          // if node is empty do nothing... (Recursion)
          if (node == null) {
              return;
          }
          // initialise local variables
          int type = node.getNodeType();
          String name = node.getNodeName();
  
          // detect node type
          switch (type) {
              case Node.DOCUMENT_NODE:
  
                  printDocument(((Document)node).getDocumentElement(), properties);
                  break;
              case Node.ELEMENT_NODE:
  
                  // check if its the <head> node. Nothing inside the <head> node
                  // must be
                  // part of the output, but we must scan the content of this
                  // node to get all
                  // <meta> tags
                  if (name.equals(NODE_HEAD)) {
                      m_write = false;
                  }
                  // scan element node; if a block has to be removed or replaced,
                  // break and discard child nodes
                  transformStartElement(node, properties);
  
                  // test if node has children
                  NodeList children = node.getChildNodes();
                  if (children != null) {
                      int len = children.getLength();
                      for (int i = 0; i < len; i++) {
                          // recursively call printDocument with all child nodes
                          printDocument(children.item(i), properties);
                      }
                  }
                  break;
              case Node.TEXT_NODE:
  
                  // replace subStrings in text nodes
                  transformTextNode(node);
                  break;
              default:
  
                  break;
          }
          // end of recursion, add eventual endtags and suffixes
          switch (type) {
              case Node.ELEMENT_NODE:
                  // analyse endtags and add them to output
                  transformEndElement(node);
                  if (node.getNodeName().equals(NODE_HEAD)) {
                      m_write = true;
                  }
                  break;
              case Node.DOCUMENT_NODE:
                  break;
              default:
                  break;
          }
      }
docs: Private method to parse DOM and create user defined output.<p>
  
  @param node Node of DOM from HTML code
  @param properties the file properties