CDATA End Marker ]]> in XML Text – Fix Invalid Character Data

Local only

The exact ]]> sequence is reserved as the end of a CDATA section and cannot appear literally in normal XML character data.

27 chars · 1 line

Waiting for input

Loading XML parser…

XML character-data syntax

How to fix ]]> inside normal XML text

The sample places ]]> directly in element text even though no CDATA section is open. XML reserves that sequence for closing CDATA, so normal character data must avoid the exact three-character marker. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • XML well-formedness validation
  • Broken XML example preloaded
  • Corrected XML comparison
  • .xml file import
  • Browser parser feedback
  • Browser-local processing

Steps

  1. Locate the ]]> sequence reported in ordinary text content.
  2. Confirm that no matching <![CDATA[ section is open at that location.
  3. Rewrite part of the sequence, for example by encoding > as &gt;, and validate again.

The CDATA terminator is reserved even outside CDATA

The XML grammar forbids ]]> in normal character data so the parser never has to reinterpret an accidental terminator. Encoding one character keeps the rendered text equivalent without using the reserved literal sequence.

Reserved CDATA terminator in XML text example

Encode the greater-than sign so the literal ]]> sequence no longer appears.

Invalid XML

<root>value ]]> more</root>

Corrected XML

<root>value ]]&gt; more</root>

Common questions

Frequently asked questions

Can ]]> appear in normal XML text?

No. The literal sequence is forbidden in ordinary character data.

Can I write &gt; instead of >?

Yes. Encoding the greater-than sign breaks the reserved literal sequence while preserving the text value.

Is this the same as an unclosed CDATA section?

No. This case has no open CDATA section; the reserved closing marker appears in normal text.

Debugging a specific XML issue? Browse XML troubleshooting.