1 |
joko |
1.1 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
## ------------------------------------------------------------------------- |
4 |
|
|
## $Id: xupdate.pl,v 1.3 2003/05/06 15:35:49 joko Exp $ |
5 |
|
|
## ------------------------------------------------------------------------- |
6 |
|
|
## $Log: xupdate.pl,v $ |
7 |
|
|
## ------------------------------------------------------------------------- |
8 |
|
|
|
9 |
|
|
|
10 |
|
|
package test; |
11 |
|
|
|
12 |
|
|
use strict; |
13 |
|
|
use warnings; |
14 |
|
|
|
15 |
|
|
BEGIN { |
16 |
|
|
use lib '../../../libs'; |
17 |
|
|
} |
18 |
|
|
|
19 |
|
|
use Data::Dumper; |
20 |
|
|
use XML::XUpdate::XSLT; |
21 |
|
|
|
22 |
|
|
use shortcuts::files qw( f2s s2f ); |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
sub main { |
26 |
|
|
|
27 |
|
|
my $xupdate = XML::XUpdate::XSLT->new( |
28 |
|
|
debug => 0, |
29 |
|
|
warnings => 1, |
30 |
|
|
); |
31 |
|
|
|
32 |
|
|
$xupdate->open_document( f2s("document.xml") ); |
33 |
|
|
#$xupdate->open_xupdate( f2s("01_xupdate_insert-after.xml") ); |
34 |
|
|
#$xupdate->open_xupdate( f2s("02_xupdate_insert-before.xml") ); |
35 |
|
|
#$xupdate->open_xupdate( f2s("03_xupdate_insert-special.xml") ); |
36 |
|
|
#$xupdate->open_xupdate( f2s("04_xupdate_append.xml") ); |
37 |
|
|
#$xupdate->open_xupdate( f2s("05_xupdate_update.xml") ); |
38 |
|
|
#$xupdate->open_xupdate( f2s("06_xupdate_remove.xml") ); |
39 |
|
|
#$xupdate->open_xupdate( f2s("07_xupdate_rename.xml") ); |
40 |
|
|
$xupdate->open_xupdate( f2s("08_xupdate_variables.xml") ); |
41 |
|
|
|
42 |
|
|
$xupdate->process() or die("Could not apply XUpdate to xml document (ERROR while processing)."); |
43 |
|
|
if (my $result = $xupdate->toString()) { |
44 |
|
|
print STDOUT $result, "\n"; |
45 |
|
|
#s2f("wd_document.xml", $result); |
46 |
|
|
} else { |
47 |
|
|
print STDERR "$0: No result or error while applying XUpdate payload to XML document.", "\n"; |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
main(); |
53 |
|
|
print "ready.", "\n"; |
54 |
|
|
|
55 |
|
|
1; |
56 |
|
|
__END__ |