commands.sh

xml select

all

Select from XML documents using XPATHs. Tip: use `xml elements` to display the XPATHs of an XML document.

More info →

Options (8)

boolean

Select all elements matching "XPATH1" and print the value of their sub-element "XPATH2"

Example: xml {{[sel|select]}} {{[-t|--template]}} {{[-m|--match]}} "{{XPATH1}}" {{[-v|--value-of]}} "{{XPATH2}}" {{path/to/input.xml|URI}}
-t, --templateboolean

Select all elements matching "XPATH1" and print the value of their sub-element "XPATH2"

Example: xml {{[sel|select]}} {{[-t|--template]}} {{[-m|--match]}} "{{XPATH1}}" {{[-v|--value-of]}} "{{XPATH2}}" {{path/to/input.xml|URI}}
-m, --matchboolean

Select all elements matching "XPATH1" and print the value of their sub-element "XPATH2"

Example: xml {{[sel|select]}} {{[-t|--template]}} {{[-m|--match]}} "{{XPATH1}}" {{[-v|--value-of]}} "{{XPATH2}}" {{path/to/input.xml|URI}}
-v, --value-ofboolean

Select all elements matching "XPATH1" and print the value of their sub-element "XPATH2"

Example: xml {{[sel|select]}} {{[-t|--template]}} {{[-m|--match]}} "{{XPATH1}}" {{[-v|--value-of]}} "{{XPATH2}}" {{path/to/input.xml|URI}}
-T, --textboolean

Match "XPATH1" and print the value of "XPATH2" as text with new-lines

Example: xml {{[sel|select]}} {{[-T|--text]}} {{[-t|--template]}} {{[-m|--match]}} "{{XPATH1}}" {{[-v|--value-of]}} "{{XPATH2}}" {{[-n|--nl]}} {{path/to/input.xml|URI}}
-n, --nlboolean

Match "XPATH1" and print the value of "XPATH2" as text with new-lines

Example: xml {{[sel|select]}} {{[-T|--text]}} {{[-t|--template]}} {{[-m|--match]}} "{{XPATH1}}" {{[-v|--value-of]}} "{{XPATH2}}" {{[-n|--nl]}} {{path/to/input.xml|URI}}
-f, --inp-nameboolean

Count all nodes in one or more XML documents

Example: xml {{[sel|select]}} {{[-T|--text]}} {{[-t|--template]}} {{[-f|--inp-name]}} {{[-o|--output]}} " " {{[-v|--value-of]}} "count(node())" {{[-n|--nl]}} {{path/to/input1.xml|URI}} {{path/to/input2.xml|URI}}
-o, --outputboolean

Count all nodes in one or more XML documents

Example: xml {{[sel|select]}} {{[-T|--text]}} {{[-t|--template]}} {{[-f|--inp-name]}} {{[-o|--output]}} " " {{[-v|--value-of]}} "count(node())" {{[-n|--nl]}} {{path/to/input1.xml|URI}} {{path/to/input2.xml|URI}}

Examples (5)

Select all elements matching "XPATH1" and print the value of their sub-element "XPATH2"

xml [sel|select] [-t|--template] [-m|--match] "XPATH1" [-v|--value-of] "XPATH2" path/to/input.xml|URI

Match "XPATH1" and print the value of "XPATH2" as text with new-lines

xml [sel|select] [-T|--text] [-t|--template] [-m|--match] "XPATH1" [-v|--value-of] "XPATH2" [-n|--nl] path/to/input.xml|URI

Count the elements of "XPATH1"

xml [sel|select] [-t|--template] [-v|--value-of] "count(XPATH1)" path/to/input.xml|URI

Count all nodes in one or more XML documents

xml [sel|select] [-T|--text] [-t|--template] [-f|--inp-name] [-o|--output] " " [-v|--value-of] "count(node())" [-n|--nl] path/to/input1.xml|URI path/to/input2.xml|URI

Display help

xml [sel|select] --help
made by @shridhargupta | data from tldr-pages