XML Parsing/Modules

2010-04-07 Thread Open Source
I'm new to perl and I need to parse an file which contains both structured and 
unstructured XML messages. Can someone help me to understand how to parse XML 
files/data into either simple readable or html format? I'm not sure how to 
proceed like which module I've have to use etc. any pointers would be much 
appreciated.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: XML Parsing/Modules

2010-04-07 Thread Open Source
Thanks Shawn/Rob! I'll give a try now. one more thing, anyway to convert these 
parsed output to html format directly with the help another module?

> - Original Message -
> From: Shawn H Corey
> Sent: 04/08/10 04:00 AM
> To: Robert Wohlfarth
> Subject: Re: XML Parsing/Modules
> 
Robert Wohlfarth wrote:
> On Wed, Apr 7, 2010 at 2:39 PM, Open Source  wrote:
> 
>> I'm new to perl and I need to parse an file which contains both structured
>> and unstructured XML messages. Can someone help me to understand how to
>> parse XML files/data into either simple readable or html format? I'm not
>> sure how to proceed like which module I've have to use etc. any pointers
>> would be much appreciated.
>>
> 
> I've used XML::Parser <http://search.cpan.org/dist/XML-Parser/Parser.pm> to
> do simple things. The documentation is here:
> http://search.cpan.org/dist/XML-Parser/Parser.pm.
> 

There are a number of XML parsers available on CPAN http://search.cpan.org/

The two most commonly use are:

XML::Simple http://search.cpan.org/~grantm/XML-Simple-2.18/lib/XML/Simple.pm

XML::LibXML http://search.cpan.org/~pajas/XML-LibXML-1.70/LibXML.pod

Others are:

XML::Twig http://search.cpan.org/~mirod/XML-Twig-3.34/Twig_pm.slow

XML::SAX http://search.cpan.org/~grantm/XML-SAX-0.96/SAX.pm

XML::DOM http://search.cpan.org/~tjmather/XML-DOM-1.44/lib/XML/DOM.pm

All of these except XML::LibXML are built on top of XML::Parser.


-- 
Just my 0.0002 million dollars worth,
 Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

Eliminate software piracy: use only FLOSS.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Modules download from CPAN

2010-04-09 Thread Open Source
I would like to download all the modules (atleast important ones) from cpan 
website and keep them in my local disk rather going into www everytime. Can 
someone tell how to download all of them? Cheers

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Modules download from CPAN

2010-04-09 Thread Open Source
Shawn, actually I would setup something like mirror site (locally) so all the 
modules.

> - Original Message -
> From: Shawn H Corey
> Sent: 04/09/10 08:04 PM
> To: Open Source
> Subject: Re: Modules download from CPAN
> 
Open Source wrote:
> I would like to download all the modules (atleast important ones) from cpan 
> website and keep them in my local disk rather going into www everytime. Can 
> someone tell how to download all of them? Cheers
> 

Sorry, you have to decide which ones are the important ones first.


-- 
Just my 0.0002 million dollars worth,
 Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

Eliminate software piracy: use only FLOSS.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




XML Parser Error

2010-04-15 Thread Open Source
I'm getting this error:

Undefined subroutine &XML::Simple::XMLin called at ./sample.pl line 3.

Here's my code and input file:

use XML::Simple;
use Data::Dumper;
$data = XMLin("sample.xml");
print Dumper($data);



 John
 43
 M
 Operations


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: XML Parser Error

2010-04-16 Thread Open Source
> - Original Message -
> From: Brad Baxter
> Sent: 04/16/10 01:31 AM
> To: beginners@perl.org
> Subject: Re: XML Parser Error
> 
On 4/15/2010 1:40 PM, Open Source wrote:
> I'm getting this error:
>
> Undefined subroutine&XML::Simple::XMLin called at ./sample.pl line 3.
>
> Here's my code and input file:
>
> use XML::Simple;
> use Data::Dumper;
> $data = XMLin("sample.xml");
> print Dumper($data);
>
> 
> 
> John
> 43
> M
> Operations
> 

There must be something else going on.
Works okay for me:

 >> cat qt
#!/usr/local/bin/perl

use warnings;
use strict;

use XML::Simple;
use Data::Dumper;
my $data = XMLin("sample.xml");
print Dumper($data);

 >> ./qt
$VAR1 = {
 'department' => 'Operations',
 'name' => 'John',
 'age' => '43',
 'gender' => 'M'
 };

Thanks Brad/Steve, I had an issue in sourcing the XML::Simple from my 
distributed platform. I've redownloaded the module and my code now works!

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/