Here you can find the source of removeAttribute(Element elem, String name)
public static void removeAttribute(Element elem, String name)
//package com.java2s; /*/*from w w w . java 2 s . c o m*/ * ==================================================================== * This software is subject to the terms of the Common Public License * Agreement, available at the following URL: * http://www.opensource.org/licenses/cpl.html . * Copyright (C) 2003-2004 TONBELLER AG. * All Rights Reserved. * You must accept the terms of that agreement to use this software. * ==================================================================== * * */ import org.w3c.dom.Element; public class Main { /** * Oracle 10i does not allow to remove an attribute that does * not exist. This method will silently ignore any exceptions * that occur while removing the attribute. */ public static void removeAttribute(Element elem, String name) { try { elem.removeAttribute(name); } catch (Exception e) { // ignore } } }