HomeXML Character Escape

XML Character Escape

Convert special characters to XML entities for valid XML documents

About XML Character Escaping

XML (eXtensible Markup Language) is a markup language for storing and transporting data. Certain characters have special meanings in XML, and using them directly causes parsing errors, so they need to be escaped as entity references.

XML escaping ensures that data can be safely embedded in XML documents, regardless of what characters the data contains. This is crucial for generating valid XML output, processing user input, and data exchange.

XML Escape Rules

Original CharacterEntity ReferenceNumeric ReferenceDescription
<&lt;&#60;Less than
>&gt;&#62;Greater than
&&amp;&#38;Ampersand
"&quot;&#34;Double quote
'&apos;&#39;Apostrophe

Common Use Cases

XML Document Generation

Ensure text data is properly escaped when dynamically generating XML content.

SOAP Web Services

Special characters need to be escaped when included in SOAP messages.

Configuration Files

Handle values containing special characters when editing XML configuration files.

Data Export

Ensure data integrity when exporting data to XML format.

Usage Tips

  • &lt; and &amp; must be escaped in all XML content
  • &gt; can sometimes be left unescaped, but it's recommended to always escape it
  • Quotes in attribute values need to be escaped based on the quote type used
  • CDATA sections can avoid escaping but cannot contain ]]>
  • Numeric character references can represent any Unicode character

CDATA Sections

For text containing many special characters, CDATA sections can be used to avoid escaping. CDATA sections start with <![CDATA[ and end with ]]>, and content within is not processed by the XML parser.

Data is processed locally in your browser by default and will not be uploaded to any server. Upload will be clearly indicated if required.

© 2026 See-Tool. All rights reserved. | Contact Us