Unescaped Quote in XML Attribute – Fix Broken Attribute Values

Local only

A quote matching the attribute delimiter ends the value, so the same quote cannot appear literally inside that value.

26 chars · 1 line

Waiting for input

Loading XML parser…

XML attribute escaping

How to fix an unescaped quote inside an XML attribute

The sample opens note with a double quote and then uses another literal double quote before hello, which ends the attribute early. Escape delimiter quotes as entities or use the other quote style around the whole value. 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. Identify whether the attribute uses single or double quotes as delimiters.
  2. Escape matching inner double quotes as " or matching inner apostrophes as ', or switch the outer delimiter.
  3. Validate the entire start tag after the edit.

The delimiter quote cannot appear literally inside the same value

XML uses the opening quote to decide where an attribute value begins and the matching quote to decide where it ends. Entity references let the same character appear as data without changing the syntax boundary.

Unescaped quote in XML attribute example

Encode the inner double quotes while keeping double quotes as the value delimiter.

Invalid XML

<root note="say "hello""/>

Corrected XML

<root note="say &quot;hello&quot;"/>

Common questions

Frequently asked questions

How do I put a double quote inside a double-quoted XML attribute?

Use &quot; for the inner double quote.

Can I use single quotes around an XML attribute value?

Yes. Single-quoted and double-quoted attribute values are both valid XML.

Do text nodes need quotes escaped the same way?

No. Quote characters are normally fine in element text; this issue is specific to attribute delimiters.

Debugging a specific XML issue? Browse XML troubleshooting.