Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

XML::Simple version difference?

by Anonymous Monk
on Jul 23, 2004 at 09:04 UTC ( [id://376833]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Heydly ho.

I'm using XML::Simple to parse some XML data, and it works so fine on my Mac Panther OSX with XML::Simple 2.11. When I upload the same file however onto a Linux Red Hat ES box with XML::Simple 2.12, it doesn't parse the data at all.

I am wondering if there is a difference in the version or something? do I have to downgrade? The XML::Parser on the Linux Red Hat ES box works fine with all the other xml I have thrown at it do far, but this one just returns nothing.

Here is the xml:

<?xml version="1.0"?> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:photo="http://www.pheed.com/pheed/" > <channel> <title>title</title> <description>desc</description> <language>en-us</language> <lastBuildDate>Fri, 23 Jul 2004 07:31:15 GMT</lastBuildDate> <image> <url>url</url> <link>link</link> </image> <item> <title>Titel</title> <link>link</link> <guid isPermaLink="false">5001811502</guid> <description></description> <photo:imgsrc>imgsrc</photo:imgsrc> <photo:thumbnail>thumbnail</photo:thumbnail> <dc:creator>creator</dc:creator> <dc:rights>rights</dc:rights> <dc:subject>subject</dc:subject> </item> </rss>

And the code:

my $xml = eval { XMLin($xml_results) } or die(@$); print Dumper($xml);

On one machine this formats a nice refrence to the xml object. On the other it outputs "undef"

Any ideas? or should I just scrap XML::Simple?

Replies are listed 'Best First'.
Re: XML::Simple version difference?
by gellyfish (Monsignor) on Jul 23, 2004 at 09:15 UTC

    Works fine for me with both versions 2.09 and 2.12 however would suggest that if you as it appears you are doing stuff with RSS then you might want to look at XML::RSS instead.

    /J\

Re: XML::Simple version difference?
by beable (Friar) on Jul 23, 2004 at 09:19 UTC
    I have a Linux box with XML::Simple 2.12 on it, and this works fine; except for that your XML is broken and doesn't have a tag to close </channel>
Re: XML::Simple version difference?
by pbeckingham (Parson) on Jul 23, 2004 at 13:35 UTC

    Your XML is invalid. There is a <channel> tag, but no closing </channel> tag. Could it be that one version of the parser is more forgiving than the other?

Re: XML::Simple version difference?
by grantm (Parson) on Jul 24, 2004 at 01:21 UTC

    I have noticed that one of the SAX parsers (XML::LibXML I think) does not generate exceptions for missing closing tags. Perhaps you have XML::SAX installed on the machine that accepts this file.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://376833]
Approved by ysth
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found