edit [--editor|:E filename]
[--all|:A] [--noindent|:n] [--recover|:r] [--keep-blanks|:k]
[--allow-empty|:0] [--no-coment|:q] [--encoding|:e encoding] expression
This command may be used to interactively edit parts of a XML document directly in your favorite editor.
A given expression is evaluated to a node-list and the
first the first resulting node is opened
in an external editor as a XML fragment.
When the editor exits, the (possibly modified) fragment
is parsed and returned to the original document. Unless
--no-comment (:q) flag is
used, the XML fragment is preceded with a XML comment specifying
canonical XPath of the node being edited.
The command returns a node-list consisting of nodes that resulted from parsing the individual edits.
--editor or :E
option may be used to specify external editor command.
If not specified, environment variables
EDITOR and VISUAL
are tried first, then vi editor
is used as a fallback.
If --all or :A
flag is present, all nodes from the node-list
are opened in the editor, one at a time.
If --recover or :r
is specified, the parser tries to recover from possible
syntax errors when parsing the resulting XML.
--keep-blanks or :b
option may be used to force the parser to
include ignorable white space.
If the result saved
by the editor is empty, the interactive
XSH2 shell asks user to confirm this was correct.
This confirmation can be suppressed using
--allow-empty or
:0 (zero) options.
The --encoding or :e
parameter can be used to specify character encoding to
use when communicating with the external editor.
Example 27. Edit all chapter elements (one by one) with emacs
edit --editor 'emacs -nw' --encoding iso-8859-1 --all //chapter