
mattmansd
New User
Nov 7, 2011, 4:41 PM
Post #1 of 1
(444 views)
|
|
XML read/re-write
|
Can't Post
|
|
I am need od assistance. I have been tasked with the following: Read an XML file, look to see that there are "transactions" at a certain XPath. Look at specific attributes to determine if the transactions should be kept or removed. If all transactions are removed, insert a placeholder transaction. Example XML, in this case I would be writing out the same XML without Transaction elements 1,2,4,5: <ROOT> <STUFF> <Transaction ItemNum="1" Valid="Yes" Keep="No"/> <Transaction ItemNum="2" Valid="Yes" Keep="No"/> <Transaction ItemNum="3" Valid="Yes" Keep="Yes"/> <Transaction ItemNum="4" Valid="Yes" Keep="No"/> <Transaction ItemNum="5" Valid="Yes" Keep="No"/> </STUFF> </ROOT> Example XML, in this case I would be writing out the same XML without Transaction elements 1,2,3,4,5 and inserting a new element that looks like <Transaction ItemNum="0"> <ROOT> <STUFF> <Transaction ItemNum="1" Valid="Yes" Keep="No"/> <Transaction ItemNum="2" Valid="Yes" Keep="No"/> <Transaction ItemNum="3" Valid="Yes" Keep="No"/> <Transaction ItemNum="4" Valid="Yes" Keep="No"/> <Transaction ItemNum="5" Valid="Yes" Keep="No"/> </STUFF> </ROOT> Any help would be greatly appreciated.
|