Skip to main content
Question

Deleting elements in an XML file

  • May 17, 2019
  • 1 reply
  • 127 views

pcowley
Participant
Forum|alt.badge.img

I have an XML file (see example attachment) from which I want to delete all Notification elements when the Notification type is 'Change of Circumstances'. So in this case I'd start with 3 Notification elements (New Claim, Change of Circumstances and Claim Termination) and once I've deleted the 'Change of Circumstances' Notification I'd just be left with 2 Notification elements (New Claim and Claim Termination).

I'd found this article (https://knowledge.safe.com/questions/77687/deleting-elements-in-xml-file.html) which seems to be what I'm after but I'm struggling to replicate it with my file.

I've been using Text File Reader with parameter 'Read Whole File at Once' set to 'Yes' and the XMLUpdater with Delete XML Path (though I'm struggling what syntax I need in the XML Path).

For info. I'm using Workbench 2018.1.2

Thanks in advance.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

takashi
Celebrity
  • May 17, 2019

This XPath expression might be what you want.

//Notification[@type="Change of Circumstances"]

See here to learn more about XPath: XPath Tutorial