======Command xed======
====Name====
**xed** evaluate an xpath expression and edits every matching node outputing the result document
====Synopsis====
xed [ [[SerializationOptions serialization options]] ] [options]
====Description====
NOTE: This program is being replaced by xedit with better control over editing features
====Options====
||-i,-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. 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,-add expr||Adds the expression (string, element, attribute) to all matching nodes||
||-e,-xpath xpath-expr||xpath expression||
||-m,-matches matches-expr||XSLT matches expression||
||-ren,-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||
||-rx,-replacex xpath||Replace matched node with evaluation of xpath with context at current node||
Supports the standard [ [[SerializationOptions serialization options]] ]
====Examples====
Replaces the the node matching the xpath express //node with a text node "text" from the file "file.xml" , send to output.
%%(shell)
xed -i file.xml -r text //node
%%
Adds an attribute to all file elements
%%(shell)
xed -a -matches file <[ attribute { "attr" } { "value" } ]>
%%
Deletes all nodes where the file[@name eq 'test']
%%(shell)
xed -d -matches "file[@name eq 'test']"
%%
Add the child element under the root element
%%
xed -a <[ ]> -xpath /root
%%
Replace the /root/foo2 element with
%%
xed -r <[]> -e /root/foo2
%%
====Return Value====
Returns 0 if the the xpath expression executed successfully. otherwise 1
----
[[Commands]]
[[CommandXaddattribute xaddattribute]]
[[CommandXdelete xdelete]]
[[CategoryCommands]]