Hello all,
In the below attached image have a root and childNodes. So here I want to first check, if I have a Address element in file, then grab a parent elements and add/append all the address elements to it. if there are no address then leave it.
In the new Xml document I should have Same as output.
I first used GetElementstagbyname(PACKAGE) method to get package (the one below ROOT)
then in Foreach loop iterating over all descendants to find out Address
Now I would like to write a utility function like if Address element is found then get Parents of that particular package
I actually don't want to use multiple foreach loops to iterate over child nodes the below is just a example and I actually have a huge file and my parent elements will be different (for eg: package1 and package 2 the parents for Address element is different).
I am not able to figure it out how to get parent elements
Below is the sample code I tried and its not in good shape as I am still trying.
Can anyone please help me out ..
In the below attached image have a root and childNodes. So here I want to first check, if I have a Address element in file, then grab a parent elements and add/append all the address elements to it. if there are no address then leave it.
In the new Xml document I should have Same as output.
I first used GetElementstagbyname(PACKAGE) method to get package (the one below ROOT)
then in Foreach loop iterating over all descendants to find out Address
Now I would like to write a utility function like if Address element is found then get Parents of that particular package
I actually don't want to use multiple foreach loops to iterate over child nodes the below is just a example and I actually have a huge file and my parent elements will be different (for eg: package1 and package 2 the parents for Address element is different).
I am not able to figure it out how to get parent elements
Below is the sample code I tried and its not in good shape as I am still trying.
Can anyone please help me out ..