Forrest logo
tool overview
On this page you find all important commands for the CLI tool xmlstarlet. If the command you are looking for is missing please ask our AI.

xmlstarlet

XMLStarlet is a command line tool for processing XML documents. It provides a set of commands that allow users to query, edit, and transform XML files.

With XMLStarlet, you can easily extract data from XML documents using XPath expressions. It supports both simple and complex queries, allowing you to retrieve specific elements, attributes, or even entire subtrees.

The tool also offers various editing capabilities. You can update, add, or delete elements, attributes, or text within an XML document. XMLStarlet provides different options to modify XML files according to your specific requirements.

XMLStarlet allows for XML document transformation using XSLT stylesheets. You can apply predefined or custom stylesheets to convert XML data into different formats, such as HTML or plain text.

It also has features for pretty-printing, validating, and validating against a schema. The tool can reformat XML documents to improve their readability and structure. Additionally, XMLStarlet can validate XML files against DTD or XSD schema to ensure their conformity to the specified structure.

XMLStarlet supports integration with other command line tools through its pipe functionality. You can use it with standard Unix utilities like grep, awk, and sed to process XML data in combination with regular expressions.

The command line tool is available for various platforms, including Linux, Mac OS X, and Windows. It can be easily installed and used from the command line or integrated into shell scripts for automation tasks.

XMLStarlet has good documentation that provides detailed information on all available commands, options, and examples. The documentation helps users quickly understand and utilize the tool's features for XML processing.

The tool is open source and released under the MIT license. This allows users to freely use, modify, and distribute XMLStarlet according to their needs.

Overall, XMLStarlet is a powerful and flexible command line tool for XML processing, suitable for a wide range of tasks such as data extraction, editing, transformation, and validation.

List of commands for xmlstarlet:

  • xmlstarlet:tldr:1338d xmlstarlet: Print all nodes that match a given XPath.
    $ xmlstarlet select --template --copy-of ${xpath} ${filename-xml}
    try on your machine
    explain this command
  • xmlstarlet:tldr:3da92 xmlstarlet: Format an XML document and print to stdout.
    $ xmlstarlet format ${filename-xml}
    try on your machine
    explain this command
  • xmlstarlet:tldr:47140 xmlstarlet: List a given directory as XML (omit argument to list current directory).
    $ xmlstarlet ls ${path-to-directory}
    try on your machine
    explain this command
  • xmlstarlet:tldr:47832 xmlstarlet: Delete all matching nodes in place (source file is changed).
    $ xmlstarlet edit --inplace --delete ${xpath} ${file-xml}
    try on your machine
    explain this command
  • xmlstarlet:tldr:9e401 xmlstarlet: Escape or unescape special XML characters in a given string.
    $ xmlstarlet [un]escape ${string}
    try on your machine
    explain this command
  • xmlstarlet:tldr:9f8c5 xmlstarlet: Update the value of all matching nodes in place (source file is changed).
    $ xmlstarlet edit --inplace --update ${xpath} --value ${new_value} ${file-xml}
    try on your machine
    explain this command
  • xmlstarlet:tldr:d3fcf xmlstarlet: Insert an attribute to all matching nodes, and print to stdout (source file is unchanged).
    $ xmlstarlet edit --insert ${xpath} --type attr --name ${attribute_name} --value ${attribute_value} ${filename-xml}
    try on your machine
    explain this command
tool overview