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:
pattern matching in XML file

 



upendra_singh
New User

May 14, 2008, 6:49 AM

Post #1 of 3 (1200 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>13.3.1.4</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/Parser.pm line 187
please help me out in doing this...if there is any other way than using XML parser then plz tell me.


winfinit
User

May 15, 2008, 10:53 PM

Post #2 of 3 (1127 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 http://search.cpan.org/~msergeant/XML-Parser-2.36/Parser.pm is what you are missing...


upendra_singh
New User

Jun 8, 2008, 10:56 PM

Post #3 of 3 (794 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