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

Remove XML tag if it matches the content given in the xPath #4686

Open
alwinjmjak opened this issue Nov 19, 2024 · 0 comments
Open

Remove XML tag if it matches the content given in the xPath #4686

alwinjmjak opened this issue Nov 19, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@alwinjmjak
Copy link

What problem are you trying to solve?

I have a xml like below,

<arg1>value1</arg1>
<arg1>value2</arg1>

I want to remove arg1 tag only if the content matches value1. The current rewrite-xml receipe has RemoveXmlTag which removes only the specified tags from the xml and does not match the values.

Describe the solution you'd like

The xPath matcher should support matching the content.

Have you considered any alternatives or workarounds?

A simple workaround is to introduce a new variable, say 'valueMatcher' in RemoveXmlTag and match the tag content with it.

Additional context

Here is a list of xPath syntax which has an example of xPath which can also match the content of the xml tag.

Are you interested in contributing this feature to OpenRewrite?

Yes. I will work on the solution and send a PR.

@alwinjmjak alwinjmjak added the enhancement New feature or request label Nov 19, 2024
@timtebeek timtebeek moved this to Backlog in OpenRewrite Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

1 participant