Java XML Attribute Add addAttribute(Document doc, Element parent, String attribute, Object value)

Here you can find the source of addAttribute(Document doc, Element parent, String attribute, Object value)

Description

add Attribute

License

Open Source License

Declaration

public static Attr addAttribute(Document doc, Element parent, String attribute, Object value) 

Method Source Code

//package com.java2s;

import org.w3c.dom.*;

public class Main {
    public static Attr addAttribute(Document doc, Element parent, String attribute, Object value) {
        Attr attr = doc.createAttribute(attribute);
        attr.setValue(String.valueOf(value));
        parent.setAttributeNode(attr);/*from  ww  w .j  a  v  a  2 s  .  com*/

        return attr;
    }
}

Related

  1. addArrayAnyTypeAttribute(Element element, Collection col)
  2. addArrayOffsetAttribute(Element element, int offset)
  3. addAttrDirect(Map values, Element el)
  4. addAttribute(Document doc, Element node, String name, String value)
  5. addAttribute(Document doc, Element node, String name, String value)
  6. addAttribute(Document doc, Node parentNode, String name, String content)
  7. addAttribute(Document doc, org.w3c.dom.Element e, String index, String value)
  8. addAttribute(Document doc, String name, Element e, String value)
  9. addAttribute(Document document, Node node, String attName, String attValue)