code: private Element createElement(String namespaceURI, String qName,
                                    Attributes attributes) {
          Element newElement = currentDocument.createElement(qName);
  
          if (namespaceURI != null && namespaceURI.length() > 0) {
              newElement.setPrefix(namespaceURI);
          }
  
          for(int i = 0; attributes != null && i < attributes.getLength(); ++i) {
              newElement.setAttribute(attributes.getQName(i),
                                      attributes.getValue(i));
          }
  
          return newElement;
      }
docs: Create a DOM Element for insertion into the current document
  @param namespaceURI
  @param qName
  @param attributes
  @return the created Element