Skip to main content
Question

Deleting elements in an XML file

  • May 17, 2019
  • 1 reply
  • 112 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.

1 reply

takashi
Influencer
  • 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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings