Files
cheatsheet-tldr/tldr/xml-escape
2025-05-12 00:21:19 +00:00

22 lines
487 B
Plaintext

---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# xml escape
> Escape special XML characters, e.g. `<a1>` → `&lt;a1&gt;`.
> More information: <https://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html#idm47077139540960>.
- Escape special XML characters in a string:
`xml {{[esc|escape]}} "{{<a1>}}"`
- Escape special XML characters from `stdin`:
`echo "{{<a1>}}" | xml {{[esc|escape]}}`
- Display help:
`xml {{[esc|escape]}} --help`