diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:50 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-26 13:17:50 -0600 |
commit | b363d2579af0a11b77e698aed2e1021c2233b644 (patch) | |
tree | f4a47b87354b7a6a3b266c8121bd8ddaeb7accaa /tderesources/groupwise/soap/extractxml.pl | |
parent | 61bddfe3a7226b18c68a76124b727c736f431688 (diff) | |
download | tdepim-b363d2579af0a11b77e698aed2e1021c2233b644.tar.gz tdepim-b363d2579af0a11b77e698aed2e1021c2233b644.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tderesources/groupwise/soap/extractxml.pl')
-rwxr-xr-x | tderesources/groupwise/soap/extractxml.pl | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tderesources/groupwise/soap/extractxml.pl b/tderesources/groupwise/soap/extractxml.pl new file mode 100755 index 000000000..ecab50861 --- /dev/null +++ b/tderesources/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; +} |