Add new XML attribute for an Element

Apache 2.0

Add new XML attribute with value on a specified element.

org.openrewrite.xml.AddTagAttribute

Required

The name of the element whose attribute's value is to be added. Interpreted as an XPath expression.

The name of the new attribute.

The new value to be used for key specified by attributeName.

mod run . --recipe=org.openrewrite.xml.AddTagAttribute \ -P elementName=//beans/bean \ -P attributeName=attribute-name \ -P newValue=value-to-add

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.