/[cvs]/nfo/perl/scripts/xupdate/xupdate.pl
ViewVC logotype

Annotation of /nfo/perl/scripts/xupdate/xupdate.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Tue May 6 15:35:49 2003 UTC (20 years, 11 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +23 -9 lines
File MIME type: text/plain
updated pod and comments
played with xml document rewriting as post xupdate operation to polish the payload

1 joko 1.1 #!/usr/bin/perl
2    
3     ## -------------------------------------------------------------------------
4 joko 1.3 ## $Id: xupdate.pl,v 1.2 2003/05/01 23:43:58 joko Exp $
5 joko 1.1 ## -------------------------------------------------------------------------
6     ## $Log: xupdate.pl,v $
7 joko 1.3 ## Revision 1.2 2003/05/01 23:43:58 joko
8     ## required debugging flag
9     ##
10 joko 1.2 ## Revision 1.1 2003/05/01 20:41:47 joko
11     ## initial commit, partly from joko/Scripts/xupdate/xupdate.pl.
12     ##
13 joko 1.1 ## -------------------------------------------------------------------------
14    
15    
16     =pod
17    
18    
19     =head1 NAME
20    
21     xupdate.pl
22    
23    
24     =head2 Description
25    
26     Please visit "perldoc XML::XUpdate::XSLT".
27    
28    
29     =head3 Todo
30    
31 joko 1.3 o mimic interface from already established "xupdate.pl" written by Petr Pajas
32     o replace shortcuts::files through File::Butler?
33     o write out result document into file named "wd_result.xml"
34     o use nice (human readable) xml formatting there with some XML::Writer???
35 joko 1.1
36    
37     =cut
38    
39    
40     package main;
41    
42     use strict;
43     use warnings;
44    
45     BEGIN {
46     use lib '../../libs';
47     }
48    
49 joko 1.3 use Data::Dumper;
50 joko 1.1 use XML::XUpdate::XSLT;
51 joko 1.3
52     use shortcuts::files qw( f2s s2f );
53 joko 1.1
54    
55     sub main {
56    
57     my $xupdate = XML::XUpdate::XSLT->new(
58 joko 1.2 debug => 0,
59     warnings => 1,
60 joko 1.1 );
61    
62     #print Dumper($xupdate);
63    
64 joko 1.3 # Open example files from Working Draft.
65 joko 1.1 $xupdate->open_document( f2s("wd_document.xml") );
66     $xupdate->open_xupdate( f2s("wd_xupdate.xml") );
67    
68 joko 1.3 # Apply xupdate to document, convert to raw xml and dump this to STDOUT.
69 joko 1.1 $xupdate->process();
70 joko 1.3 my $result;
71    
72     # Produce human readable format, using indentation and stuff.
73     #$result = $xupdate->toString( rewrite => 1, using => "PerlSAX", mode => "readable" );
74     $result = $xupdate->toString( rewrite => 0, using => "XMLParser", mode => "readable" );
75     # Produces canonical format, just a long line.
76     #$result = $xupdate->toString("canonical");
77 joko 1.1
78     # some error checking ...
79     if ($result) {
80 joko 1.3 print STDOUT $result, "\n";
81     #s2f("wd_document.xml", $result);
82 joko 1.1 } else {
83 joko 1.3 print STDERR "$0: No result or error while applying XUpdate payload to XML document.", "\n";
84 joko 1.1 }
85    
86     }
87    
88     main();
89     print "ready.", "\n";
90    
91     1;
92     __END__

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed