SocialedYourFace
New Member
I have been struggling with this at work today. Trying to read in an XML file like the one below (that I have quickly just typed in). I have a CSV file of \[code\]show_id\[/code\] codes. So I read them in and put them in a hash. Then I read in the XML file using \[code\]XML::Simple\[/code\].I then compare the \[code\]show_id\[/code\] code in the element (done a loop with an array as in the online examples and then \[code\]$a = $data->{Element1}->{Element2}->{show_id}\[/code\] and that found it) below and see if I have a match on the hash table. Bingo. I got that to work with no problem.So let's say I match the middle two \[code\]Element2\[/code\] elements with \[code\]show_id\[/code\] values of \[code\]ABC11\[/code\] and \[code\]ABC12\[/code\]. Now I need to write a new file of the ones that do match. So I tried doing \[code\]XMLout\[/code\] and I seem to lose the whole tag structure that I read in.Is there any way to read in the data below and get rid of the records \[code\]ABC10\[/code\] and \[code\]ABC14\[/code\] for instance, and wring out the file in the same format? Let me know if that makes sense. Also I only have \[code\]XML::Simple\[/code\] and \[code\]XML:arser\[/code\] installed at work. Please HELP!!!\[code\]<?xml version="1.0" encoding="ISO-8859-1"?><main> <Element1> <Element2> <show/> <show_id>ABC10</show_id> <staring> <show_header>This is a test</show_header> </staring> </Element2> <Element2> <show/> <show_id>ABC11</show_id> <staring> <show_header>This is a test</show_header> </staring> </Element2> <Element2> <show/> <show_id>ABC12</show_id> <staring> <show_header>This is a test</show_header> </staring> </Element2> <Element2> <show/> <show_id>ABC14</show_id> <staring> <show_header>This is a test</show_header> </staring> </Element2> </Element1></main>\[/code\]