Here you can find the source of createAttribute(String sName, String sValue, Node nParent)
Parameter | Description |
---|---|
sName | The name of the attribute. |
sValue | The value of the atrtibute. |
nParent | The parent node. |
public static void createAttribute(String sName, String sValue, Node nParent)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { /**/*from ww w .j a va 2 s. c om*/ * This method creates an attribute with the given name and value. * * @param sName The name of the attribute. * @param sValue The value of the atrtibute. * @param nParent The parent node. */ public static void createAttribute(String sName, String sValue, Node nParent) { if ((nParent != null) && (nParent instanceof Element)) { Element eParent = (Element) nParent; eParent.setAttribute(sName, sValue); } } }