Java XML Attribute Set setAttributeValue(final Element target, final String attributeName, final String value)

Here you can find the source of setAttributeValue(final Element target, final String attributeName, final String value)

Description

set Attribute Value

License

Apache License

Declaration

public static boolean setAttributeValue(final Element target, final String attributeName, final String value) 

Method Source Code

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

import org.w3c.dom.*;

public class Main {
    public static boolean setAttributeValue(final Element target, final String attributeName, final String value) {
        final NamedNodeMap map = target.getAttributes();
        final Node attributeValueHolder = map.getNamedItem(attributeName);
        if (attributeValueHolder != null) {
            attributeValueHolder.setNodeValue(value);
            return true;
        }/*from w w w.  ja v  a  2  s .com*/
        return false;
    }
}

Related

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