I am trying to read in an XML file and check if a list ofcertain codes are contained in an element. If so I simply want to keep those records that match and discard the ones that do not match. In other words like searching for a key value on a table and only returning that set. So far I have managed to read the file and interogate the element. Then I try and write out the XML that I was reading and it seems to lose the tags of the outer elements. It is as if some of the inner elements become attributes of the outer eleemnts. I print Dumper and I can see the data. So I am wondering do I parse the data into a structure and then once I have found all the records I require write that out to an XML file? Or to a flate file? Been going up and down all day on the net and cannot seem to get the solution I need. Please help.