XML Escape / Unescape
Escape or unescape XML characters.
Loading…
About XML Escape / Unescape
Building an RSS item, a SOAP body or a sitemap by hand is fine until a title contains an ampersand and the whole file stops parsing. Escape rewrites & < > " and ' as the entities XML itself defines, using ' for the apostrophe. It also deletes control characters that XML 1.0 forbids outright, which can otherwise make a document invalid. Unescape goes the other way, but only for those five names and numeric references.
Features
- Escapes the five predefined XML entities
- Writes the apostrophe as '
- Deletes control characters that XML 1.0 cannot hold
- Unescape decodes the five named entities and numeric references
- Leaves HTML-only names such as © as written when unescaping
Limitations
- Characters XML 1.0 forbids, such as most control codes, are removed from the output rather than escaped, so the text changes.
- Only text is escaped: the tool does not add CDATA sections, build tags or check that a whole document is well-formed.
How it works
- Paste the text or attribute value into the XML Input panel.
- Pick Escape or Unescape with the toggle in the middle column.
- Check the XML Output panel, which refreshes with every keystroke.
- Copy the result with Copy Output and paste it between your tags or inside the attribute quotes.
Example input
Price: $5 <tax not="included">Frequently asked questions
- It was one XML 1.0 does not allow in any form, usually a control code such as the ones that sneak in from copied binary or terminal output. There is no entity that can represent it, so the tool removes it.
- XML defines only five named entities, and the others need a DTD to mean anything. Numeric references such as © are decoded. For HTML-style names, use the HTML Escape tool's Unescape mode.
- Not strictly: in text only the ampersand and the less-than sign must be escaped. Quotes matter inside attribute values. This tool escapes all five anyway, which is always valid.
- Yes. Every ampersand in the address has to be written as & inside an XML file. Paste the URL, choose Escape and copy the result into your loc element.
