From 7a10026b1dd87d0ae68d8e5251ca47eed4a36100 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 27 Aug 2020 06:52:39 +1000 Subject: [PATCH] add removeAttribute method to Xpp3Dom (#94) * add removeAttribute method to Xpp3Dom Signed-off-by: olivier lamy * add javadoc Signed-off-by: olivier lamy --- .../java/org/codehaus/plexus/util/xml/Xpp3Dom.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java b/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java index db628e41..4f268f9d 100644 --- a/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java +++ b/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java @@ -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; @@ -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 true 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 *