2021-08-16 08:23:55 -04:00
|
|
|
# xml format
|
2021-08-14 18:17:52 -04:00
|
|
|
|
2021-08-15 14:38:24 -04:00
|
|
|
> Format an XML document.
|
2021-08-15 07:19:09 -04:00
|
|
|
> More information: <http://xmlstar.sourceforge.net/docs.php>.
|
2021-08-14 18:17:52 -04:00
|
|
|
|
2021-08-15 14:38:24 -04:00
|
|
|
- Format an XML document, indenting with tabs:
|
|
|
|
|
2021-08-20 21:33:37 -04:00
|
|
|
`xml format --indent-tab {{path/to/input.xml|URI}} > {{path/to/output.xml}}`
|
2021-08-15 14:38:24 -04:00
|
|
|
|
|
|
|
- Format an HTML document, indenting with 4 spaces:
|
|
|
|
|
2021-08-20 21:33:37 -04:00
|
|
|
`xml format --html --indent-spaces {{4}} {{path/to/input.html|URI}} > {{path/to/output.html}}`
|
2021-08-15 14:38:24 -04:00
|
|
|
|
|
|
|
- Recover parsable parts of a malformed XML document, without indenting:
|
|
|
|
|
2021-08-20 21:33:37 -04:00
|
|
|
`xml format --recover --noindent {{path/to/malformed.xml|URI}} > {{path/to/recovered.xml}}`
|
2021-08-15 14:38:24 -04:00
|
|
|
|
2021-08-23 21:26:03 -04:00
|
|
|
- Format an XML document from stdin, removing the `DOCTYPE` declaration:
|
2021-08-15 14:38:24 -04:00
|
|
|
|
2021-08-20 21:33:37 -04:00
|
|
|
`cat {{path\to\input.xml}} | xml format --dropdtd > {{path/to/output.xml}}`
|
2021-08-15 14:38:24 -04:00
|
|
|
|
|
|
|
- Format an XML document, omitting the XML declaration:
|
|
|
|
|
2021-08-20 21:33:37 -04:00
|
|
|
`xml format --omit-decl {{path\to\input.xml|URI}} > {{path/to/output.xml}}`
|
2021-08-15 14:38:24 -04:00
|
|
|
|
2021-08-16 08:23:55 -04:00
|
|
|
- Display help for the `format` subcommand:
|
2021-08-14 18:17:52 -04:00
|
|
|
|
|
|
|
`xml format --help`
|