The source CSV file has quotes around the string in column 1 which I cannot change. I need a way for the above script to remove or ignore double quotes.. even snipping a character from the beginning and end would do. Any help appreciated. Cheers, Jake#!/usr/bin/perl -w #fn - First Name #ct - Extension #use strict ; #use warnings ; #Name if the File that contains the User Direcotry Data open (FILE, 'phonelist.csv') || die("Could not open the input file dir +ectory.csv!\n"); #create if not yet created and/or overwrite existing directory-0000000 +00000.xml open (OUTPUTFILE, ">000000000000-directory.xml") || die("Could not ope +n/create the output file directory-000000000000.xml!\n"); #below section contains the standard [general] header of the sip.conf print OUTPUTFILE "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone= +\"yes\"?>\n"; print OUTPUTFILE "<directory>\n"; print OUTPUTFILE "\t<item_list>\n"; while (<FILE>) { chomp; ################################################################### #we are splitting the comma seperated values into the single Items# #add additional $columnX to accomodate further entries# ################################################################### ($column1,$column2,) = split(','); print OUTPUTFILE "\t\t<item>\n"; print OUTPUTFILE "\t\t\t<fn>$column1</fn>\n"; print OUTPUTFILE "\t\t\t<ct>$column2</ct>\n"; print OUTPUTFILE "\t\t</item>\n"; } print OUTPUTFILE "\t</item_list>\n"; print OUTPUTFILE "</directory>\n"; #close the csv example file close (FILE); #close the modified sip.conf file close (OUTPUTFILE); exit;
In reply to Remove Double Quotes from XML Output by JakeBloomfield
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |