Revision [1157]
This is an old revision of CommandXed made by DavidLee on 2010-02-05 13:37:31.
Command xed
Name
xed evaluate an XPATH expression and edits every matching node outputing the result documentSynopsis
xed [ serialization options ] [options]Description
Options
-i input -input input | use input as the source xml document, otherwise stdin
if input is an XML expression then use it directly (dont treat as filename). |
-n | do not use a source context |
-r replace expr -replace expr | replace expr. If replace is string then replace the child text of matching nodes, if replace is an XML expression then replace the matching node with the expression. |
-d | Delete matching expression |
-a expr -add expr | Adds the expression (string, element, attribute) to all matching nodes |
-xpath xpath-expr -e xpath-expr | xpath expression |
-matches matches-expr -m matches-expr | XSLT matches expression |
-ren string -rename string | Renames the matching element or attribute to a new name |
-v | Read remaining pairs of arguments as name/value pairs to assign as xpath variables |
Supports the standard [ serialization options ]
Examples
Replaces the the node matching the xpath express node with a text node "text"
xed -i file.xml -r text //node
Adds an attribute to all file elements
xed -a -matches file <[ attribute { "attr" } { "value" } ]>
Return Value
Returns 0 if the the xpath expression executed successfully. otherwise 1Commands
CategoryCommands