From 34630fba75141611f4f448d7c1c76f9f27fee0bf Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Wed, 26 Aug 2020 21:11:30 +1000 Subject: [PATCH 1/2] add removeAttribute method to Xpp3Dom Signed-off-by: olivier lamy --- src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java | 6 ++++++ 1 file changed, 6 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..d77304d3 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,11 @@ public String getAttribute( String name ) return ( null != attributes ) ? attributes.get( name ) : null; } + public boolean removeAttribute( String name ) + { + return StringUtils.isEmpty( name ) ? false: attributes.remove( name ) == null; + } + /** * Set the attribute value * From ad3b75c3eb22eb444e17b44fea601aecc5668596 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Wed, 26 Aug 2020 21:14:43 +1000 Subject: [PATCH 2/2] add javadoc Signed-off-by: olivier lamy --- src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java | 6 ++++++ 1 file changed, 6 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 d77304d3..4f268f9d 100644 --- a/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java +++ b/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java @@ -184,6 +184,12 @@ 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;