Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: XML parsing

by mscharrer (Hermit)
on Sep 17, 2008 at 09:34 UTC ( [id://711940]=note: print w/replies, xml ) Need Help??


in reply to XML parsing

If the output is XML only try the stringification operator "" or join:
my $ref = XMLin("@outputInfo");

Replies are listed 'Best First'.
Re^2: XML parsing
by Jenda (Abbot) on Sep 17, 2008 at 12:53 UTC

    This would add spaces into the data. If you do not want the data split into lines, do not split it. It's much better to assign all the data into a single scalar right away than to split it and then merge it back.

    my $data = qx[$cmd];
      Yes, you are of course right. I was only looking on the xmlin line not on the qx one. However, the added spaces shouldn't do any harm in normal XML files.

      I had the "@array" version in mind because I used XML::Simple just this week and had to read the input file manually line-wise to fix a known broken tag before calling xmlin.

        Depends on what do you call normal. It will not corrupt the XML, but it may change the text content of some tags. Even in a data-oriented XML. I don't know about your XML files, but mine often do contain tags with several lines long content.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-29 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found