Remove XML tag if only matches specific value #4674
-
I have a xml like below,
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. Is there any option to match the content and remove the specified tag from the xml ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @alwinjmjak ; Thanks for reaching out! RemoveXmlTag takes in an XPath expression as argument. Have you checked to see if you can give it an expression that would match on tag contents? I haven't tried that myself yet, but it's worth exploring. https://stackoverflow.com/a/2637909 Otherwise adding support for such |
Beta Was this translation helpful? Give feedback.
Hi @alwinjmjak ; Thanks for reaching out! RemoveXmlTag takes in an XPath expression as argument. Have you checked to see if you can give it an expression that would match on tag contents? I haven't tried that myself yet, but it's worth exploring. https://stackoverflow.com/a/2637909
Otherwise adding support for such
//a[text()='Example']
expressions would be the way forward, and any help towards that on a draft PR with tests would be appreciated.