Java Utililty Methods XML Attribute Remove

List of utility methods to do XML Attribute Remove

Description

The list of methods to do XML Attribute Remove are organized into topic(s).

Method

voidremoveAttribute(Node iNode, String iAttributeName)
This method removes the specified attribute from the specified node
NamedNodeMap attrList = iNode.getAttributes();
attrList.removeNamedItem(iAttributeName);
voidremoveAttribute(Node iNode, String iAttributeName)
This method removes the specified attribute from the specified node
NamedNodeMap attrList = iNode.getAttributes();
attrList.removeNamedItem(iAttributeName);
voidremoveAttribute(Node node, String attName)
remove Attribute
NamedNodeMap attributes = node.getAttributes();
attributes.removeNamedItem(attName);
voidremoveAttribute(Node node, String attr)
Removes a named attribute of a Node

if (node == null)
    throw new IllegalArgumentException("Node argument cannot be null");
if (attr == null)
    throw new IllegalArgumentException("Node attribute argument cannot be null");
NamedNodeMap map = node.getAttributes();
if (map != null) {
    Node an = map.getNamedItem(attr);
    if (an != null)
...
voidremoveAttribute(Node node, String attrName)
remove Attribute
final NamedNodeMap attrNode = node.getAttributes();
if (attrNode == null) {
    return;
attrNode.removeNamedItem(attrName);
booleanremoveAttribute(Node node, String... attributs)
remove Attribute
NamedNodeMap att = node.getAttributes();
if (att == null)
    return false;
boolean ret = false;
for (String attribut : attributs) {
    if (att.getNamedItem(attribut) != null) {
        att.removeNamedItem(attribut);
        ret = true;
...
voidremoveAttribute(Node parent, String name, String value, boolean recursive)
remove Attribute
NamedNodeMap nnm = parent.getAttributes();
if (nnm != null)
    if (value == null)
        nnm.removeNamedItem(name);
    else {
        Node attr = nnm.getNamedItem(name);
        if (attr != null) {
            String attrVal = attr.getNodeValue();
...
voidremoveAttributeIgnoreCase(Element element, String attributeName)
Removes the DOM attribute from element with the given name.
Attr a = getAttributeIgnoreCase(element, attributeName);
if (a != null) {
    element.removeAttributeNode(a);
voidremoveAttributes(Element e, String namespaceURI)
Remove all attributes with a certain namespace from this element.
NamedNodeMap attributes = e.getAttributes();
ArrayList list = new ArrayList();
for (int i = 0; i < attributes.getLength(); i++) {
    Attr a = (Attr) attributes.item(i);
    if (namespaceURI.equals(a.getNamespaceURI())) {
        list.add(a);
Iterator i = list.iterator();
while (i.hasNext()) {
    e.removeAttributeNode((Attr) i.next());
voidremoveAttributes(Element elem)
remove Attributes
if (elem.hasAttributes()) {
    NamedNodeMap attributeMap = elem.getAttributes();
    int n = attributeMap.getLength();
    Attr[] attributes = new Attr[n];
    for (int i = 0; i < n; i++)
        attributes[i] = (Attr) attributeMap.item(i);
    for (int i = 0; i < n; i++)
        elem.removeAttributeNode(attributes[i]);
...