Here you can find the source of createElement(Document dom, String elementName, Properties attributes)
public static Element createElement(Document dom, String elementName, Properties attributes)
//package com.java2s; /******************************************************************************* * Copyright (c) 2004, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w w w. j ava 2 s . c o m*/ * IBM Corporation - initial API and implementation *******************************************************************************/ import java.util.Enumeration; import java.util.Properties; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { public static Element createElement(Document dom, String elementName, Properties attributes) { // make sure to create element with any namespace uri to enable finding // it again using Dom.getElementsByTagNameNS() Element element = dom.createElementNS("", elementName); //$NON-NLS-1$ if (attributes != null) { Enumeration e = attributes.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); element.setAttribute(key, attributes.getProperty(key)); } } return element; } }