Revision [1227]

This is an old revision of CommandXed made by DavidLee on 2010-02-15 10:13:35.

 

Command xed


Name

xed evaluate an xpath expression and edits every matching node outputing the result document

Synopsis

xed [ serialization options ] [options]


Description



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).
-ndo not use a source context
-r,-replace exprreplace 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 exprAdds the expression (string, element, attribute) to all matching nodes
-e,-xpath xpath-exprxpath expression
-m,-matches matches-exprXSLT matches expression
-ren,-rename stringRenames the matching element or attribute to a new name
-vRead 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" from the file "file.xml" , send to output.
xed -i file.xml -r text //node 


Adds an attribute to all file elements

xed -a -matches file <[ attribute { "attr" } { "value" } ]>



Deletes all nodes where the file[@name eq 'test']
xed -d -matches "file[@name eq 'test']"



Add the child element under the root element
xed -a <[ <child/> ]> -xpath /root


Replace the /root/foo2 element with <bletch/>
xed -r <[<bletch/>]> -e /root/foo2






Return Value

Returns 0 if the the xpath expression executed successfully. otherwise 1


Commands
xaddattribute
xdelete
CategoryCommands
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki