Change XML tag value

Apache 2.0

Alters the value of XML tags matching the provided expression. When regex is enabled the replacement happens only for text nodes provided the pattern matches.

org.openrewrite.xml.ChangeTagValue

Required

The name of the element whose value is to be changed. Interpreted as an XPath Expression.

The new value for the tag. Supports capture groups when regex is enabled. If literal $,\ characters are needed in newValue, with regex true, then it should be escaped.

Optional

The old value of the tag. Interpreted as pattern if regex is enabled.

regexBoolean

Default false. If true, oldValue will be interpreted as a Regular Expression, and capture group contents will be available in newValue.

mod run . --recipe=org.openrewrite.xml.ChangeTagValue \ -P elementName=/settings/servers/server/username \ -P newValue=user

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