3 ###APPAUTHOR: xiaoranzzz
4 ###APPDATE: Tue Mar 11 04:58:02 2008
6 ###APPDESC: create simple xml using XML::Simple,\n\tRead data from commandline,standardIn
7 ###APPUSAGE: tagname:prop=value,[prop=value,...]:text
8 ###APPEXAMPLE: xmlout book:name=Bash Reference:
13 exit(system("plhelp",$0,@ARGV)) if($_ eq "-h" || $_ eq "--help");
26 print('<?xml version="1.0" encoding="utf-8" standalone="yes"?>',"\n");
28 foreach my $LINE(@DATA) {
29 my @match = $LINE =~ /^([^:]+):([^:]*):(.*)$/;
31 my $tagname = $match[0];
32 my $proptext = $match[1];
35 my @match = $proptext =~ /([^=]+)=([^,]*),?/g;
37 for(my $i=0;$i<@match;$i+=2) {
38 print(" $match[$i]=\'$match[$i+1]\'");
41 print($text ?
"><![CDATA[$text]]><\/$tagname>" : ' />',"\n");