Java XML Attribute Set setAttributeValue(Node node, String attribute, String value)

Here you can find the source of setAttributeValue(Node node, String attribute, String value)

Description

set Attribute Value

License

Apache License

Declaration

public static void setAttributeValue(Node node, String attribute, String value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class Main {
    public static void setAttributeValue(Node node, String attribute, String value) {
        NamedNodeMap attributes = node.getAttributes();
        if (attributes != null) {
            Node nameAttr = attributes.getNamedItem(attribute);
            if (nameAttr != null) {
                nameAttr.setNodeValue(value);
            }/* w  ww . j av a 2s. c o  m*/
        }
    }
}

Related

  1. setAttribute(String name, String value, Element el)
  2. setAttributeNS(Element node, String namespaceURI, String prefix, String nodeName, String value)
  3. setAttributeValue(Element element, String attribute, String value)
  4. setAttributeValue(final Element target, final String attributeName, final String value)
  5. setAttributeValue(Node node, String attName, String attValue)
  6. setAttributeValue(Node sNode, String attribName, String val)
  7. setPropertyIfAttributePresent( BeanDefinitionBuilder builder, Element element, String attributeName)
  8. setPropertyReference(BeanDefinitionBuilder builder, Element element, String attribute, String property)