A command-line XML/XSLT toolkit. Note: You will likely need to…
A command-line XML/XSLT toolkit. Note: You will likely need to know XPath: https://developer.mozilla.org/en-US/docs/Web/XPath. More information: https://xmlstar.sourceforge.net/docs.php.
stdout
:xmlstarlet format {{path/to/file.xml}}
stdin
:{{cat path/to/file.xml}} | xmlstarlet format
xmlstarlet select --template --copy-of {{xpath}} {{path/to/file.xml}}
stdout
(source file is unchanged):xmlstarlet edit --insert {{xpath}} --type attr --name {{attribute_name}} --value {{attribute_value}} {{path/to/file.xml}}
xmlstarlet edit --inplace --update {{xpath}} --value {{new_value}} {{file.xml}}
xmlstarlet edit --inplace --delete {{xpath}} {{file.xml}}
xmlstarlet [un]escape {{string}}
xmlstarlet ls {{path/to/directory}}