View Single Post
Newbie Member
7Jul2008,15:43  
tress's Avatar
Hi,

Please excuse me if this post is a little sketchy first post here. I am trying to work my way through a folder containing many xml files, a lot of these files dont have correct opening and closing xml tags contained within. What I want to do is read each file and extract 4 tags from each (these tags are properly openeded and closed with <>) and if at all possible load them into 1 Excel Sheet for later importing so I will have 4 columns and 1 xml file per row, I have some script that will read 1 file and output it to the screen but will not do a lot else, while outputtin I would also like to fix the bad tags replacing &lt; with < and &gt with > if this is also possible.

My script so far, sorry there is not more

#!/usr/bin/perl
use XML::Simple;

my $xml = XMLin('280643TextCopy.txt');

print "InstitutionType=$xml->{InstitutionType}\n";
print "InstitutionName=$xml->{InstitutionName}\n";
print "InstitutionNumber=$xml->{InstitutionNumber}\n";
print "InspectionNumber=$xml->{InspectionNumber}\n";
print "TransformedXML=$xml->{InspectionReport}->{TransformedXml}\n";

I am running this on a Windows XP machine, if a sample of the XML is needed as well I can provide this.

Thanks T