← 返回命令列表

Linux command

xml-select 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Select nodes with XPath

xml select -t -v "[//element]" [file.xml]

Extract multiple values

xml select -t -m "[//item]" -v "[@name]" -n [file.xml]

Select with namespace

xml select -N [ns=http://example.com] -t -v "[//ns:element]" [file.xml]

Copy matching nodes

xml select -t -c "[//element]" [file.xml]

说明

xml select queries XML documents using XPath expressions. Part of xmlstarlet toolkit. Extracts values, attributes, and node sets from XML files.

参数

-t, --template
Start template.
-v, --value-of _xpath_
Output value of XPath expression.
-m, --match _xpath_
Match XPath expression.
-c, --copy-of _xpath_
Copy matching nodes.
-n, --nl
Output newline.
-N _prefix=uri_
Define namespace prefix.
-T
Text output mode.

FAQ

What is the xml-select command used for?

xml select queries XML documents using XPath expressions. Part of xmlstarlet toolkit. Extracts values, attributes, and node sets from XML files.

How do I run a basic xml-select example?

Run `xml select -t -v "[//element]" [file.xml]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -t, --template do in xml-select?

Start template.