mvitor has asked for the wisdom of the Perl Monks concerning the following question:
My xml structure is in this way:use XML::Twig; my $twig = XML::Twig->new(keep_encoding => "true"); $twig->parse("$string"); foreach my $product ($twig->root->children('produto')) { my $sibling = $product->first_child(); my %produto; do { $produto{$sibling->tag()} = $sibling->child_text(); } while($sibling = $sibling->next_sibling()); $product{nome} =~ s/\s+//g; ...................... }
And my problem is:<produtos> <produto> <codigo>I0000949</codigo> <nome>Acucareiro Acril 200g Cromus Acrylic Line</nome> <categoria>SALA DE JANTAR:ACESSÓRIOS PARA MESA</categoria> <marca>Fabrica da Pedra</marca> <preco></preco> <link>4,99</link> <imagem>http://imgproduto.casaevideo.com.br/jpg/ud-cozin/000094 +9b.jpg</imagem> <parcelamento> <parcelas>12</parcelas> <valor>0,53</valor> </parcelamento> </produto> ...... </produtos>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig Question
by Jenda (Abbot) on Nov 01, 2007 at 19:15 UTC | |
by mvitor (Beadle) on Nov 05, 2007 at 15:34 UTC | |
|
Re: XML::Twig Question
by Anonymous Monk on Nov 01, 2007 at 15:44 UTC |