LinuxCommandLibrary

xml

XMLStarlet command-line XML toolkit

TLDR

Validate XML

$ xml val [file.xml]
copy
Format/pretty print
$ xml fo [file.xml]
copy
XPath query
$ xml sel -t -v "[//element]" [file.xml]
copy
Transform with XSLT
$ xml tr [transform.xsl] [file.xml]
copy
Edit in place
$ xml ed -u "[//node]" -v "[value]" [file.xml]
copy

SYNOPSIS

xml command [options] files

DESCRIPTION

xml is the main command of XMLStarlet, a comprehensive command-line XML toolkit for querying, editing, validating, and transforming XML documents. It provides a set of subcommands that cover common XML processing tasks without requiring a full programming language.
Key subcommands include val for validating XML against DTDs or schemas, fo for pretty-printing and reformatting XML, sel for selecting data using XPath expressions, ed for editing XML elements and attributes in place, and tr for applying XSLT transformations. Each subcommand has its own set of options tailored to its specific operation.
XMLStarlet is designed for shell scripting and automation, allowing XML processing tasks to be integrated into pipelines and build scripts. It reads from files or stdin and writes to stdout, following Unix conventions for composability.

PARAMETERS

val

Validate.
fo
Format.
sel
Select (XPath).
tr
Transform.
ed
Edit.
-t -v XPATH
Template value.

CAVEATS

XMLStarlet specific. Complex XPath syntax. Many subcommands.

HISTORY

XMLStarlet (xml command) is a command-line XML toolkit for querying, validating, and transforming XML.

SEE ALSO

xmllint(1), xsltproc(1), jq(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community