in reply to XML to CSV conversion

The following translates your xml into a Perl structure that you can extract the data from and format as desired:

use strict; use warnings; use Data::Dumper; use XML::Simple; $/=undef; my $xml = <DATA>; my $ref = XMLin $xml; print Dumper $ref; __DATA__ <event rev="1.2"> <date>2014-01-10-07:59:24.439+05:30I-----</date> <outcome status="0">0</outcome> <originator blade="webseald" instance="default"><component rev="1.4">a +uthn</component> <event_id>101</event_id> <action>0</action> <location>PosIntWebSeal1prod</location> </originator> <accessor name=""> <principal auth="IV_LDAP_V3.0" domain="Default">goldytelecom</principa +l> <name_in_rgy>uid=GOLDYTELECOM,cn=external,cn=Users,o=vodafone,c=in</na +me_in_rgy><session_id>05262372-799f-11e3-96d8-00145ee78c6d </session_id><user_location>10.77.50.58</user_location><user_location_ +type>IPV4</user_location_type> </accessor><target resource="7"><object></object></target> <authntype>formsPassword</authntype><data> </data> </event>

Replies are listed 'Best First'.
Re^2: XML to CSV conversion
by tousifp (Novice) on Jan 14, 2014 at 10:58 UTC

    Thanks hdb!!! But is there any other alternative to this? Because the output is a bit lengthy!

      Well, you need to pick the pieces you want, like:

      print $ref->{originator}{location},"\n";

        What if I want to read the xml input from a file and then process it?