xmlmod(1) - Linux man page
Name
xmlmod - Modifies xmlfiles.
Syntax
xmlmod [options] path
Description
Modify xmlfiles. Change values. (Conditionally) Add nodes. Sort nodes based on property values.
- Format of path:
- node:prop/VAL - matching criteria
node:prop//VAL - set value of prop to VAL
node:prop/// - remove property from node
node:prop/OLD/NEW - set prop to NEW if current value is OLDNODE = textual name of node or '@' to denote a textnode
MATCH = PROP/"VALUE"
ASSIGN = PROP//"VALUE"
DELETE_PROP = PROP///
MATCH_ASSIGN = PROP/"OLD"/"NEW"
MATCH_ASSIGN will be split into MATCH + ASSIGN.o For an ASSIGN to be performed on a node all MATCHes must evaluate to true.
o If any MATCH fails and ADD is true => then a new node is created that evaluates true to all MATCHes. This new node is also subjected to all ASSIGNs.
ACTION = MATCH | ASSIGN | DELETE_PROP | MATCH_ASSIGN
ADD = '+'[PRELF POSTLF]
DELETE = '^'[PRELF POSTLF]
STMT = [ADD|DELETE]NODE(:ACTION)*
PATH = STMT(.STMT)*Textnodes: Textnodes are indicated by giving "@" instead of "NODE:PROP".
@/"VALUE" to match. @//"VALUE" to assign.
@"/"MATCH"/"VALUE" to assign if matched.--chain nodes matched in first path are marked as ALLOW. Next path will only compare successfully against ALLOW-nodes. ADD-flag compares against all nodes (not restrained by ALLOW).
Options
- -f file
- Use file as input.
- -a --all
- Modify every matching node, disregarding paths.
- -b --bind
- Create new nodes adjecent to another node of same name.
- -g --global
- Match globaly.
- -s --stdin
- Read paths from sdtin.
- -S --sort
- Sorting mode.
- -T --treesort
- Use treesort.
- -n --nonumsort
- Do not sort numerically.
- -c --chain
- Chained paths. Only nodes matched in previous paths are accessible.
- -h, --help
- Output help information and exit.
- -v, --version
- Output version information and exit. -V, --verbose Print debug information.
Examples
xmlmod path.to:prop/val.node:prop/old/new
xmlmod path.to.+11create:prop//value
Create text under the node named out. xmlmod test.out.+@//hello
Sort nodes named "xmpl" at the given level of the DOM tree. Primary sortkey is property "p1", secondary is property "p2".
xmlmod -S path.to.xmpl:p1:p2
Authors
Jens L��s <Jens.Laas@data.slu.se>