Xsh


Table of Contents

XSH - XML Editing Shell 
install XSH from CPAN 
Using xsh to scrape web pages 
XSH, An XML Editing Shell 
Introduction 
xsh Basics 
Creating and Editing XML Documents 
xsh Scripting 
Going Further 
Conclusions 
Resources 

XSH - XML Editing Shell 

install XSH from CPAN 

Ref:

required modules from CPAN:

Parse-RecDescent
Term-ReadLine-Perl
Text-Balanced
Text-Iconv
XML-Filter-BufferText
XML-Filter-DOMFilter
XML-LibXML
XML-LibXML-Common
XML-LibXML-Iterator
XML-LibXML-XPathContext
XML-LibXSLT
XML-NamespaceSupport
XML-NodeFilter
XML-SAX
XML-SAX-Base
XML-SAX-Writer
XML-XUpdate-LibXML

Available Debian packages:

libparse-recdescent-perl - Generates recursive-descent parsers in Perl
libterm-readline-perl-perl - Perl implementation of Readline libraries
libtext-iconv-perl - converts between character sets in Perl
libxml-filter-buffertext-perl - Perl module for putting all characters into a single event
libxml-libxml-common-perl - Perl module for common routines & constants for XML::LibXML et al
libxml-libxml-perl - Perl module for using the GNOME libxml2 library
libxml-libxslt-perl - Perl module for using the GNOME libxslt library
libxml-namespacesupport-perl - Perl module for supporting simple generic namespaces
libxml-nodefilter-perl - Perl module for a generic node-filter class for DOM traversal
libxml-sax-expat-incremental-perl - XML::SAX::Expat subclass for non-blocking (incremental) parsing
libxml-sax-expat-perl - Perl module for a SAX2 driver for Expat (XML::Parser)
libxml-sax-machines-perl - Perl modules for managing collections of SAX processors
libxml-sax-perl - Perl module for using and building Perl SAX2 XML processors
libxml-sax-writer-perl - Perl module for a SAX2 XML writer

Installation log.

$ sudo aptitude install libparse-recdescent-perl libterm-readline-perl-perl libtext-iconv-perl libxml-filter-buffertext-perl libxml-libxml-common-perl libxml-libxml-perl libxml-libxslt-perl libxml-namespacesupport-perl libxml-nodefilter-perl libxml-sax-expat-incremental-perl libxml-sax-expat-perl libxml-sax-machines-perl libxml-sax-perl libxml-sax-writer-perl
The following NEW packages will be installed:
  libxml-filter-buffertext-perl libxml-libxslt-perl libxml-nodefilter-perl
  libxml-sax-expat-incremental-perl libxml-sax-expat-perl
  libxml-sax-machines-perl libxml-sax-writer-perl
0 packages upgraded, 7 newly installed, 0 to remove and 396 not upgraded.
Need to get 182kB of archives. After unpacking 791kB will be used.

% perl -MCPAN -e "install XML::XSH2"
Checking if your kit is complete...
Looks good
 Warning: prerequisite XML::LibXML::Iterator 0 not found.
 Warning: prerequisite XML::XUpdate::LibXML 0.4.0 not found.

Running install for module XML::LibXML::Iterator
OK
  /usr/bin/make test -- OK
Running make install
Installing /usr/local/share/perl/5.8.8/XML/LibXML/Iterator.pm
Installing /usr/local/share/perl/5.8.8/XML/LibXML/NodeList/Iterator.pm
Installing /usr/local/man/man3/XML::LibXML::NodeList::Iterator.3pm
Installing /usr/local/man/man3/XML::LibXML::Iterator.3pm

Running install for module XML::XUpdate::LibXML
ok 1
  /usr/bin/make test -- OK
Running make install
Manifying blib/man1/xupdate.1p
Installing /usr/local/share/perl/5.8.8/XML/XUpdate/LibXML.pm
Installing /usr/local/share/perl/5.8.8/XML/Normalize/LibXML.pm
Installing /usr/local/man/man1/xupdate.1p
Installing /usr/local/man/man3/XML::Normalize::LibXML.3pm
Installing /usr/local/man/man3/XML::XUpdate::LibXML.3pm
Installing /usr/local/bin/xupdate
Writing /usr/local/lib/perl/5.8.8/auto/XML/XUpdate/LibXML/.packlist

Running make for P/PA/PAJAS/XML-XSH2-2.0.2.tar.gz
  Is already unwrapped into directory /vars/cpan/build/XML-XSH2-2.0.2

Failed Test Stat Wstat Total Fail  Failed  List of Failed
t/06wrap.t                56    6  10.71%  32 35 37 40 42 44
Failed 1/8 test scripts, 87.50% okay. 6/364 subtests failed, 98.35% okay.
make: *** [test_dynamic] Error 255
  /usr/bin/make test -- NOT OK
Running make install
  make test had returned bad status, won't install without force

% perl -MCPAN -e "force install XML::XSH2"
make: *** [test_dynamic] Error 255
  /usr/bin/make test -- NOT OK
Running make install
  make test had returned bad status, won't install without force

% perl -MCPAN -e shell
cpan> force install XML::XSH2
make: *** [test_dynamic] Error 255
  /usr/bin/make test -- NOT OK
Running make install
Installing /usr/local/share/perl/5.8.8/XML/XSH2.pm
Installing /usr/local/share/perl/5.8.8/XML/XSH2.pod
Installing /usr/local/share/perl/5.8.8/XML/XSH2/LibXMLCompat.pm
[...]
Installing /usr/local/man/man1/xsh.1p
Installing /usr/local/man/man3/XSH2.3
Installing /usr/local/bin/xsh
Writing /usr/local/lib/perl/5.8.8/auto/XML/XSH2/.packlist
Appending installation info to /usr/local/lib/perl/5.8.8/perllocal.pod
  /usr/bin/make install UNINST=1 -- OK

documented on: 2006.10.29