Linux command
xml-edit 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Update element value
xml edit -u "[//element]" -v "[new value]" [file.xml]
Insert element
xml edit -s "[//parent]" -t elem -n "[child]" -v "[value]" [file.xml]
Delete element
xml edit -d "[//element]" [file.xml]
Rename element
xml edit -r "[//old]" -v "[new]" [file.xml]
说明
xml edit modifies XML documents from command line. Part of xmlstarlet toolkit. Supports inserting, updating, deleting, and renaming elements and attributes.
参数
- -u, --update _xpath_
- Update matching nodes.
- -d, --delete _xpath_
- Delete matching nodes.
- -s, --subnode _xpath_
- Add subnode.
- -i, --insert _xpath_
- Insert before.
- -a, --append _xpath_
- Insert after.
- -r, --rename _xpath_
- Rename nodes.
- -v, --value _value_
- Value for operation.
- -t, --type _type_
- Node type (elem, attr, text).
- -n, --name _name_
- Node name.
- -L, --inplace
- Edit file in place.
FAQ
What is the xml-edit command used for?
xml edit modifies XML documents from command line. Part of xmlstarlet toolkit. Supports inserting, updating, deleting, and renaming elements and attributes.
How do I run a basic xml-edit example?
Run `xml edit -u "[//element]" -v "[new value]" [file.xml]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -u, --update _xpath_ do in xml-edit?
Update matching nodes.