diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /kresources/groupwise/soap/extractxml.pl | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kresources/groupwise/soap/extractxml.pl')
-rwxr-xr-x | kresources/groupwise/soap/extractxml.pl | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/kresources/groupwise/soap/extractxml.pl b/kresources/groupwise/soap/extractxml.pl new file mode 100755 index 000000000..ecab50861 --- /dev/null +++ b/kresources/groupwise/soap/extractxml.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl + +if ( @ARGV != 1 ) { + print STDERR "Usage: extractxml.pl <filename>\n"; + exit 1; +} + +$in = $ARGV[ 0 ]; + +print "In: $in\n"; + +if ( !open IN, $in ) { + print STDERR "Unable to open file '$in'.\n"; + exit 1; +} + +$count = 1; + +while ( <IN> ) { + if ( $xml ) { + if ( $_ =~ /(.*\<\/SOAP-ENV:Envelope\>)/ ) { + printXml( $xml . $1 ); + $xml = ""; + } else { + $xml .= $_; + } + } elsif ( $_ =~ /^(\<\?xml.*\?>)(.*)$/ ) { + $xml = $1 . $2; + + if ( $xml =~ /(.*\<\/SOAP-ENV:Envelope\>)/ ) { + printXml( $1 ); + $xml = ""; + + } + } +} + +sub printXml() +{ + $xml = shift; + + $xml =~ s/\n//g; + $xml =~ s/\r//g; + + $out = "$in.$count.xml"; + + print "Out: $out\n"; + + if ( !open OUT, ">$out" ) { + print STDERR "Unable to open file '$out'.\n"; + } else { + print OUT $xml; + close OUT; + } + + $count += 1; +} |