CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
XML read/re-write

 



mattmansd
New User

Nov 7, 2011, 4:41 PM

Post #1 of 1 (675 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.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives