Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: XML Parse, Spanish Elements

by planetscape (Canon)
on Feb 11, 2006 at 07:50 UTC ( #529535=note: print w/ replies, xml ) Need Help??


in reply to XML Parse, Spanish Elements

It appears that your immediate question is being satisfactorily answered. You may also wish to consider, however, whether XML::Simple is adequate for your needs.

I, and others here, really like XML::Twig. A great deal of information is available on The XML::Twig Homepage. While XML::Twig can closely emulate the behaviour of XML::Simple, it can also do a great deal more, including handling data that XML::Simple just chokes on.

Other alternatives include XML::LibXML... Stepping up from XML::Simple to XML::LibXML, appropriately enough, discusses migrating from XML::Simple to XML::LibXML.

The point is, make sure the module is a good fit for your requirements before becoming locked in.

HTH,

planetscape


Comment on Re: XML Parse, Spanish Elements
Re^2: XML Parse, Spanish Elements
by senik148 (Beadle) on Feb 11, 2006 at 19:30 UTC
    i will make sure i experiment with those other Modules.

    For now i fixed everything!
    i found the way.

    #!/usr/bin/perl -w use strict; use warnings; use XML::Simple; use LWP::Simple; # get RSS data my $raw = get('http://www.fremontvirtualoffice.com/rmmame-dep.xml'); # create object my $xml = new XML::Simple; my $data = $xml->XMLin($raw); my @items = @{$data->{noticia}}; for my $hash ( @items ) { my $title = $hash->{titulo}; my $article = $hash->{texto}; my $date = $hash->{fecha}; my $time = $hash->{hora}; my $caption = $hash->{foto}->{pie}; my $photo_big = $hash->{foto}->{fotogrande}; my $photo_small = $hash->{foto}->{fotomedia}; print "TITLE: $title\n"; print "DATE: $date\n"; print "TIME: $time\n"; print "ARTICLE: $article\n"; print "PHOTO: $photo_big\n"; print "CAPTION: $caption\n"; }


    I get all the Elements i need. Thank you all!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://529535]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-07-12 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (239 votes), past polls