Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add removeAttribute method to Xpp3Dom #94

Merged
merged 2 commits into from Aug 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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