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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by joko, Thu May 1 23:43:58 2003 UTC revision 1.3 by joko, Tue May 6 15:35:49 2003 UTC
# Line 4  Line 4 
4  ##  $Id$  ##  $Id$
5  ## -------------------------------------------------------------------------  ## -------------------------------------------------------------------------
6  ##  $Log$  ##  $Log$
7    ##  Revision 1.3  2003/05/06 15:35:49  joko
8    ##  updated pod and comments
9    ##  played with xml document rewriting as post xupdate operation to polish the payload
10    ##
11  ##  Revision 1.2  2003/05/01 23:43:58  joko  ##  Revision 1.2  2003/05/01 23:43:58  joko
12  ##  required debugging flag  ##  required debugging flag
13  ##  ##
# Line 28  Line 32 
32    
33  =head3 Todo  =head3 Todo
34    
35    o mimic interface from already established "xupdate.pl"    o mimic interface from already established "xupdate.pl" written by Petr Pajas
36    o replace shortcuts::files through File::Butler?    o replace shortcuts::files through File::Butler?
37      o write out result document into file named "wd_result.xml"
38      o use nice (human readable) xml formatting there with some XML::Writer???
39        
40    
41  =cut  =cut
# Line 44  BEGIN { Line 50  BEGIN {
50    use lib '../../libs';    use lib '../../libs';
51  }  }
52    
 use XML::XUpdate::XSLT;  
 use shortcuts::files qw( f2s );  
53  use Data::Dumper;  use Data::Dumper;
54    use XML::XUpdate::XSLT;
55    
56    use shortcuts::files qw( f2s s2f );
57    
58    
59  sub main {  sub main {
# Line 58  sub main { Line 65  sub main {
65    
66    #print Dumper($xupdate);    #print Dumper($xupdate);
67    
68    # open required files    # Open example files from Working Draft.
69    $xupdate->open_document( f2s("wd_document.xml") );    $xupdate->open_document( f2s("wd_document.xml") );
70    $xupdate->open_xupdate( f2s("wd_xupdate.xml") );    $xupdate->open_xupdate( f2s("wd_xupdate.xml") );
71    
72      # Apply xupdate to document, convert to raw xml and dump this to STDOUT.
73    $xupdate->process();    $xupdate->process();
74    my $result = $xupdate->toString();    my $result;
75      
76      # Produce human readable format, using indentation and stuff.
77      #$result = $xupdate->toString( rewrite => 1, using => "PerlSAX", mode => "readable" );
78      $result = $xupdate->toString( rewrite => 0, using => "XMLParser", mode => "readable" );
79      # Produces canonical format, just a long line.
80      #$result = $xupdate->toString("canonical");
81    
82    # some error checking ...    # some error checking ...
83    if ($result) {    if ($result) {
84      print $result, "\n";      print STDOUT $result, "\n";
85        #s2f("wd_document.xml", $result);
86    } else {    } else {
87      print "No result.", "\n";      print STDERR "$0: No result or error while applying XUpdate payload to XML document.", "\n";
88    }    }
89    
90  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

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