in reply to Re^2: OT: conversion of xml to csv before insert data into a database
in thread OT: conversion of xml to csv before insert data into a database

What you have is a php script, this is a perl script

#!/usr/bin/perl use strict; use warnings; use XML::Twig; open my $fh,'>','sortie.csv' or die "$!"; my $t = XML::Twig->new( twig_handlers => { '/xml/element' => sub { my $nom = $_[1]->first_child('nom'); my $prenom = $_[1]->first_child('prenom'); $nom = (defined $nom) ? $nom->text : ''; $prenom = (defined $prenom) ? $prenom->text : ''; print $fh "$nom;$prenom\n"; } }, ); $t->parsefile('entree.xml'); close $fh;
poj
  • Comment on Re^3: OT: conversion of xml to csv before insert data into a database
  • Download Code