Java XML Element Create createElement(Document dom, String elementName, Properties attributes)

Here you can find the source of createElement(Document dom, String elementName, Properties attributes)

Description

create Element

License

Open Source License

Declaration

public static Element createElement(Document dom, String elementName,
            Properties attributes) 

Method Source Code

//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

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));
            }//  ww  w .  j a  va  2s .  co m
        }
        return element;
    }
}

Related

  1. createElement(Document document, Element parent, String name)
  2. createElement(Document document, QName name)
  3. createElement(Document document, String name, float value)
  4. createElement(Document document, String name, Map attributes, Element... children)
  5. createElement(Document document, String name, String textContent)
  6. createElement(Document dom, String elementName, Properties attributes)
  7. createElement(Document owner, String nsURI, String elementName, String textValue)
  8. createElement(Element parent, String elementName)
  9. createElement(Element parent, String name)