Skip to content

Commit

Permalink
add removeAttribute method to Xpp3Dom (#94)
Browse files Browse the repository at this point in the history
* add removeAttribute method to Xpp3Dom

Signed-off-by: olivier lamy <olamy@apache.org>

* add javadoc

Signed-off-by: olivier lamy <olamy@apache.org>
  • Loading branch information
olamy committed Aug 26, 2020
1 parent 04fcb7b commit 7a10026
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java
Expand Up @@ -16,6 +16,7 @@
* limitations under the License.
*/

import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlSerializer;

import java.io.IOException;
Expand Down Expand Up @@ -183,6 +184,17 @@ public String getAttribute( String name )
return ( null != attributes ) ? attributes.get( name ) : null;
}

/**
*
* @param name name of the attribute to be removed
* @return <code>true</code> if the attribute has been removed
* @since 3.4.0
*/
public boolean removeAttribute( String name )
{
return StringUtils.isEmpty( name ) ? false: attributes.remove( name ) == null;
}

/**
* Set the attribute value
*
Expand Down

0 comments on commit 7a10026

Please sign in to comment.