Skip to content

Commit 7a10026

Browse files
authored
add removeAttribute method to Xpp3Dom (#94)
* add removeAttribute method to Xpp3Dom Signed-off-by: olivier lamy <[email protected]> * add javadoc Signed-off-by: olivier lamy <[email protected]>
1 parent 04fcb7b commit 7a10026

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19+
import org.codehaus.plexus.util.StringUtils;
1920
import org.codehaus.plexus.util.xml.pull.XmlSerializer;
2021

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

187+
/**
188+
*
189+
* @param name name of the attribute to be removed
190+
* @return <code>true</code> if the attribute has been removed
191+
* @since 3.4.0
192+
*/
193+
public boolean removeAttribute( String name )
194+
{
195+
return StringUtils.isEmpty( name ) ? false: attributes.remove( name ) == null;
196+
}
197+
186198
/**
187199
* Set the attribute value
188200
*

0 commit comments

Comments
 (0)