protected static Element createElement(Document document, String tagname,
			Map attributes, String text) {
		// Create the new element.
        tagname = tagname.replaceAll("'", "");
        tagname = tagname.replaceAll("&", "");
        tagname = tagname.replaceAll("\"", "");
        tagname = tagname.replaceAll("<", "");
        tagname = tagname.replaceAll(">", "");
        tagname = tagname.replaceAll(" ", "");

        
      //  System.out.println("TAG NAME = "+tagname);
		Element element = document.createElement(tagname);
		// Set the attributes.
		if (attributes != null) {
			Iterator it = attributes.keySet().iterator();
			while (it.hasNext()) {
				String name = (String) it.next();
				String value = (String) attributes.get(name);
				element.setAttribute(name, value);
			}
		}
		// Add the text element.
		if (text != null)
			element.appendChild(document.createTextNode(text));
		return element;
	}