Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Parsing XML with XML::Simple

by GrandFather (Cardinal)
on Dec 18, 2006 at 00:54 UTC ( #590367=note: print w/ replies, xml ) Need Help??

in reply to Parsing XML with XML::Simple

XML::Twig seems to do what you want if you Simplify things a little:

use strict; use warnings; use XML::Twig; use Data::Dump::Streamer; my $twig = XML::Twig->new (); $twig->parse (*DATA); my $hash = $twig->simplify (); Dump ($hash); __DATA__ <XML> <CVS> $Id:,v 1.1 2006-12-17 19:25:03 eric Exp $ </CVS> <DATE>2006-12-10</DATE> <INTRODUCTION>Blah</INTRODUCTION> <TITLE>Foo</TITLE> <AUTHOR>Bar</AUTHOR> ... <ARTICLE> foo bar baz </ARTICLE> </XML>


$HASH1 = { ARTICLE => "\nfoo bar baz\n", AUTHOR => 'Bar', content => "\n\$Id:,v 1.1 2006-12-17 19:25:03 e +ric Exp \$\n2006-12-10BlahFo". "oBar\n...\n\nfoo bar baz\n", CVS => "\n\$Id:,v 1.1 2006-12-17 19:25:03 e +ric Exp \$\n", DATE => '2006-12-10', INTRODUCTION => 'Blah', TITLE => 'Foo' };

DWIM is Perl's answer to Gödel

Comment on Re: Parsing XML with XML::Simple
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-12-28 09:34 GMT
Find Nodes?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?

    Results (180 votes), past polls