The list of methods to do XML Attribute Remove are organized into topic(s).
void
removeAllAttributes(Element element) remove All Attributes
NamedNodeMap attrs = element.getAttributes();
int attrCount = attrs.getLength();
for (int i = attrCount - 1; i >= 0; --i) {
Attr attr = (Attr) attrs.item(i);
attrs.removeNamedItemNS(attr.getNamespaceURI(), attr.getLocalName());
void
removeAllAttributes(Element element) remove All Attributes
Vector<String> names = new Vector<String>();
int length = element.getAttributes().getLength();
NamedNodeMap atts = element.getAttributes();
for (int i = 0; i < length; names.add(atts.item(i).getLocalName()), i++)
;
for (String name : names)
element.removeAttribute(name);
void
removeAllAttributes(Element element) Remove all attribute from the specified element
final NamedNodeMap nodeMap = element.getAttributes();
for (int i = 0; i < nodeMap.getLength(); i++)
element.removeAttribute(nodeMap.item(i).getNodeName());
void
removeAllAttributes(Node node, String attrName) remove All Attributes
NamedNodeMap attrs = node.getAttributes();
if (attrs != null && attrs.getNamedItem(attrName) != null) {
attrs.removeNamedItem(attrName);
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node childNode = list.item(i);
removeAllAttributes(childNode, attrName);
...
void
removeAllSubNodesExceptAttributes(Node n) remove All Sub Nodes Except Attributes
NodeList childNodes = n.getChildNodes();
List<Node> childNodesToRemove = new ArrayList<Node>();
for (int i = 0; i < childNodes.getLength(); i++) {
Node c = childNodes.item(i);
if (c.getNodeType() != Node.ATTRIBUTE_NODE) {
childNodesToRemove.add(c);
for (Node c : childNodesToRemove) {
n.removeChild(c);
void
removeAttribute(final Attr attributeNode) remove Attribute
if (attributeNode == null) {
return;
final Element owner = attributeNode.getOwnerElement();
if (owner == null) {
return;
owner.removeAttributeNode(attributeNode);
...