Java XML Attribute Remove removeAttribute(Node iNode, String iAttributeName)

Here you can find the source of removeAttribute(Node iNode, String iAttributeName)

Description

This method removes the specified attribute from the specified node

License

Creative Commons License

Parameter

Parameter Description
iNode The node whose attribute is to be removed
iAttributeName The name of the attribute to be removed

Declaration

public static void removeAttribute(Node iNode, String iAttributeName) 

Method Source Code

//package com.java2s;
/*******************************************************************************

 ADL SCORM 2004 4th Edition Sample Run-Time Environment

 The ADL SCORM 2004 4th Ed. Sample Run-Time Environment is licensed under
 Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States.

 The Advanced Distributed Learning Initiative allows you to:
 *  Share - to copy, distribute and transmit the work.
 *  Remix - to adapt the work. //from  w  w  w  . j  av a  2  s .co m

 Under the following conditions:
 *  Attribution. You must attribute the work in the manner specified by the author or
 licensor (but not in any way that suggests that they endorse you or your use
 of the work).
 *  Noncommercial. You may not use this work for commercial purposes. 
 *  Share Alike. If you alter, transform, or build upon this work, you may distribute
 the resulting work only under the same or similar license to this one. 

 For any reuse or distribution, you must make clear to others the license terms of this work. 

 Any of the above conditions can be waived if you get permission from the ADL Initiative. 
 Nothing in this license impairs or restricts the author's moral rights.

 *******************************************************************************/

import org.w3c.dom.Node;

import org.w3c.dom.NamedNodeMap;

public class Main {
    /**
     * This method removes the specified attribute from the specified node
     *
     * @param iNode The node whose attribute is to be removed
     * @param iAttributeName The name of the attribute to be removed
     */
    public static void removeAttribute(Node iNode, String iAttributeName) {
        NamedNodeMap attrList = iNode.getAttributes();
        attrList.removeNamedItem(iAttributeName);
    }
}

Related

  1. removeAttribute(Element elem, String name)
  2. removeAttribute(Element element, String name)
  3. removeAttribute(final Attr attributeNode)
  4. removeAttribute(final Node iNode, final String iAttributeName)
  5. removeAttribute(final Node node, final String name)
  6. removeAttribute(Node iNode, String iAttributeName)
  7. removeAttribute(Node node, String attName)
  8. removeAttribute(Node node, String attr)
  9. removeAttribute(Node node, String attrName)