Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Which XML parser for this type of xml queries

by Anonymous Monk
on Dec 06, 2008 at 22:37 UTC ( [id://728607]=perlquestion: print w/replies, xml ) Need Help??

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

Hi,

I'm receiving this type of xml queries from KnxWeb program (visualization web interface for home automation).

<read><objects><object id='ecl_couloir'/><object id='cur_date'/><objec +t id='cur_time'/></objects></read>

I tried XML::Simple but it gives parser error: Extra content at the end of the document.

Can I use XML::Simple for it with some proper setting ?

What would be my next choice ?

Thanks in advance,

regards,

Perl newbie-rob.

Replies are listed 'Best First'.
Re: Which XML parser for this type of xml queries
by duckyd (Hermit) on Dec 06, 2008 at 22:52 UTC
    I saved your xml to a file called example.xml and was able to use XML::Simple to parse it w/o any problem:
    $ perl -MData::Dumper -MXML::Simple -e 'print Dumper XMLin(q{example.x +ml});' $VAR1 = { 'objects' => { 'object' => { 'cur_date' => {}, 'cur_time' => {}, 'ecl_couloir' => {} } } };
    My guess is that you really do have some garbage at the end of your document - have you printed it out with, say, single quotes around it so that you'd me more likely to spot something funny? I.E.
    print "xml content: '$xml'\n";
      Thanks for the tip. I've chopped last character and now it works. But I'm still curious why is read not present in hash presentation ? It's crucial for my parsing...

      Regards,

      Rob.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-18 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found