Question

XML attribute update deletes child nodes

  • 3 October 2022
  • 1 reply
  • 2 views

Hi,

 

I have a XML file and i need to update its node.attributes by some busniess rules, i have observed that with AA360 if i update a node's attribute it gets updated successfully but it will delete the child nodes from that specific node, which is some thing i don't want to happen.

 

is there a solution to this issue using AA360 ?

 

in below XML

  <sender myCode="mycode1">

   <invoice classCode="DEV" dts="ins">

    <id ext="test" root="1"/>

   </invoice>

  </sender>

 

if i update myCode to TestCode i left with, supplying node value seems to be mandatory which i don't want,i guess that is the reason for all this trouble.

  <sender myCode="TestCode">Node update Value </sender>

 


1 reply

Userlevel 3
Badge +7

Hi @ishan mahajan​ ,

Ideally this shouldn't happen, but since it does, lets explore some workarounds.

 

Maybe reading the entire text file and using regular expressions to replace strings conditionally could help you out here.

You don't have to use the Regex Package, just the String: Replace is good enough.

 

imageCreating the regex pattern dynamically might be a challenge, but its worth a try.

 

Kind Regards,

Ashwin A.K

Reply