This repository was archived by the owner on Dec 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathxml.txt
42 lines (35 loc) · 1.75 KB
/
xml.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
XMLStarlet Toolkit: Edit XML document(s)
Usage: xml ed <global-options> {<action>} [ <xml-file-or-uri> ... ]
where
<global-options> - global options for editing
<xml-file-or-uri> - input XML document file name/uri (stdin otherwise)
<global-options> are:
-P, or -S - preserve whitespace nodes.
(or --pf, --ps) Note that space between attributes is not preserved
-O (or --omit-decl) - omit XML declaration (<?xml ...?>)
-L (or --inplace) - edit file inplace
-N <name>=<value> - predefine namespaces (name without 'xmlns:')
ex: xsql=urn:oracle-xsql
Multiple -N options are allowed.
-N options must be last global options.
--net - allow network access
--help or -h - display help
where <action>
-d or --delete <xpath>
--var <name> <xpath>
-i or --insert <xpath> -t (--type) elem|text|attr -n <name> [-v (--value) <value>]
-a or --append <xpath> -t (--type) elem|text|attr -n <name> [-v (--value) <value>]
-s or --subnode <xpath> -t (--type) elem|text|attr -n <name> [-v (--value) <value>]
-m or --move <xpath1> <xpath2>
-r or --rename <xpath1> -v <new-name>
-u or --update <xpath> -v (--value) <value>
-x (--expr) <xpath>
XMLStarlet is a command line toolkit to query/edit/check/transform
XML documents (for more information see http://xmlstar.sourceforge.net/)
xml sel -t -c "//AccountId/text()" !file!
xml fo -t !file!
xml ed -s "//AccountId" -t elem -n "Acc" -v "value" !file!
xml ed -a "//AccountId" -t elem -n "Acc" -v "value" !file!
xml ed -i "//AccountId" -t elem -n "Acc" -v "value" !file!
xml ed -u "//AccountId" -v "value" !file!
xml ed -d "//AccountId" !file!