xsh - XML Editing Shell
xsh [options] script_or_command xsh [options] -al script [arguments ...] xsh [options] -aC command [arguments ...] xsh [options] -p commands < input.xml > output.xml xsh [options] -I input.xml -O output.xml commands xsh [options] -P file.xml commands xsh [options] -cD compiled_script.pl ... xsh -u for usage xsh -h for help xsh --man for the manual page
XSH is an shell-like language for XPath-oriented editing, querying and manipulation of XML and HTML files (with read-only support for DocBook SGML). xsh can work as an interactive shell (with full command-line support such as history, TAB-completion, etc.) or as an off-line interpreter for batch processing of XML files.
xsh
See XSH2 manual page or http://xsh.sourceforge.net/documentation.html for a complete XSH language reference.
For a quick help, type xsh help (just help on xsh prompt).
xsh help
help
Type xsh help commands to get list of available XSH commands and xsh help command with command replaced by a XSH command name to get help on a particular command.
xsh help commands
xsh help command
Run xsh help Prompt to get information on how to setup the XSH2 shell prompt.
xsh help Prompt
Load and execute given XSH script (the script is executed before all other commands provided on the command-line, but after executed ~/.xsh2rc).
Indicate, that the command-line arguments are XSH commands.
Indicate, that the command-line arguments are should be passed to the script via @ARGV (in XML::XSH2::Map namespace). If used with --commands or without --load, the first argument should contain XSH commands and the rest are the passed to via @ARGV.
@ARGV
XML::XSH2::Map
--commands
--load
Indicate, that the command-line arguments should be treated as input filenames. If used with --commands or without --load, the first argument should contain XSH commands. A XSH script specified with --load or XSH commands specified with --commands (or both in this order) are evaluated repeatedly on each input file. For example, running
$ xsh -l script.xsh -FC command file1.xml file2.xml ...
is equivalent to
$ xsh --stdin -aC command file1.xml file2.xml ... for $INPUT_FILENAME in { @ARGV } { $INPUT := open $INPUT_FILENAME; . "script.xsh"; command } ^D
Don't display command-prompt even if run from a terminal, expecting XSH commands in the standard input.
Compile the XSH source and report errors, only. No commands are actually executed.
Compiles XSH source(s) into a stand-alone Perl script which can be executed simply with
perl output_filename.pl [script-arguments ... ]
The compiled Perl script still requires XML::XSH2 modules to be installed, but since it is already precompiled and also because loading of XSH grammar parser is not required, it starts almost instantly, compared to its XSH source.
Note that the compiled script includes init file (unless -f flag was used), and it also preserves run-time flag settings used during the compilation.
-f
Use -c to suppress execution of the compiled script.
-c
Quiet mode: suppress all unnecessary informatory ouptut.
Start with indent 1 (on) and keep_blanks 0 (off) to allow nice indenting of the XML output.
Start with validation, load_ext_dtd, parser_expands_entities and parser_completes_attributes 1 (on).
Start with validation, load_ext_dtd, parser_expands_entities and parser_completes_attributes 0 (off).
Print some debug messages.
Ignore ~/.xsh2rc
Print XSH version info and exit.
Start interactive mode with xsh command prompt. By default, the interactive mode is only started if xsh is running from a terminal and neither XSH commands nor a script are given on the command-line.
Force non-interactive mode.
This is a special mode in which xsh acts as a pipe-line processing tool. In this mode, first the standard input is read and opened as a document _ (underscore), then all XSH commands given in ~/.xsh2rc, command-line and given XSH scripts are applied and finally the (possibly modified) document _ is dumped back on the standard output. It is equivallent to -I - -O - and -P -.
-I - -O -
-P -
Preload given file as a document with ID _ upon startup.
Try to saves document with ID _ into given file before XSH ends.
A convenient shortcut for -I filename -O filename.
-I filename -O filename
Make XSH expect HTML documents by default in all open/save operations.
This option is included only for completeness sake. Make XSH expect XSH documents by default in all open/save operations (this is the default).
This option allows tracing the way XSH language parser processes your script.
Set the encoding that used in the XSH scripts (or keyboard input).
Set the encoding that should be used for XSH output.
Print a brief help message on usage and exits.
Prints the help page and exits.
Displays the help as manual page.
Petr Pajas <pajas@matfyz.cz>
Copyright 2000-2003 Petr Pajas, All rights reserved.
XSH2, XML::XSH2, XML::XSH2::Compile, XML::LibXML, XML::XUpdate, http://xsh.sourceforge.net/doc
To install XML::XSH2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::XSH2
CPAN shell
perl -MCPAN -e shell install XML::XSH2
For more information on module installation, please visit the detailed CPAN module installation guide.