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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
pattern matching in XML file


New User

May 14, 2008, 6:49 AM

Post #1 of 3 (1201 views)
pattern matching in XML file Can't Post

hi all,

i have a xml file a part of which is as follows </DEVICES> - <DRIVERS> - <DRIVER> <FILENAME>1394bus.sys</FILENAME> <FILESIZE>53248</FILESIZE> <CREATIONDATE>09-28-2001 12:00:00</CREATIONDATE> <VERSION>5.1.2600.2180</VERSION> <MANUFACTURER>Microsoft Corporation</MANUFACTURER> <PRODUCTNAME>Microsoft® Windows® Operating System</PRODUCTNAME> </DRIVER> - <DRIVER> <FILENAME>3xHybrid.sys</FILENAME> <FILESIZE>2825088</FILESIZE> <CREATIONDATE>02-14-2006 17:07:24</CREATIONDATE> <VERSION></VERSION> <MANUFACTURER>ASUSTek</MANUFACTURER> <PRODUCTNAME>ASUSTek 3xHybrid</PRODUCTNAME> </DRIVER> now i want to read this file in perl and say wanna know the version of the file 3xhybrid.sys(see the red colored portion). I tried it doing this using regex but could not succeed as it doesn't deal xml file as simple text file. I am looking for some xml parser thing. i am using XML::Simple like this # use module
use XML::Simple;
use Data::Dumper; # create object
$xml = new XML::Simple; # read XML file
$data = $xml->XMLin("sysdata.xml"); # print output
print Dumper($data);
just to read the file but i am getting a run time error saying Couldn't open encmap unicode.enc:
No such file or directory
at C:/Perl/lib/XML/ line 187
please help me out in doing this...if there is any other way than using XML parser then plz tell me.


May 15, 2008, 10:53 PM

Post #2 of 3 (1128 views)
Re: [upendra_singh] pattern matching in XML file [In reply to] Can't Post

i think your problem is that you dont have module dependencies installed, i am not sure if windows has cpan shell, if it does then go to cpan shell and type install XML::Simple, that will install all dependencies for you, otherwise go to, if windows doesnt have cpan shell then is what you are missing...

New User

Jun 8, 2008, 10:56 PM

Post #3 of 3 (795 views)
Re: [upendra_singh] pattern matching in XML file [In reply to] Can't Post

i tried installing xml::parser but its giving a message that i need to install expat first. i am using active perl 8.0 and it has xml::parser installed. need i install that particular version?


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

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