Unquoted XML Attribute Value – Fix Missing Attribute Quotes

Local only

XML requires attribute values to be enclosed in matching single or double quotes, even when the value contains only letters or digits.

20 chars · 1 line

Waiting for input

Loading XML parser…

XML attribute quoting

How to fix an unquoted XML attribute value

The sample writes port=8080 without quotes. Unlike HTML syntax accepted by some browsers, XML requires every attribute value to use a quoted literal such as port="8080" or port='8080'. 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. Find the attribute assignment nearest the parser error.
  2. Wrap the entire value in matching single or double quotes.
  3. Escape reserved characters inside the value if necessary, then validate again.

XML attribute quoting is mandatory

There is no unquoted shortcut for simple numeric or word values in XML. The quotes define the attribute value boundary and keep whitespace or following attributes unambiguous.

Choose the outer quote style that avoids unnecessary escaping

Both single and double quotes are valid delimiters. If the data contains one quote character frequently, using the other as the delimiter can keep the serialized XML easier to read.

Missing quotes around an XML attribute

Add quotes around the numeric port value.

Invalid XML

<service port=8080/>

Corrected XML

<service port="8080"/>

Common questions

Frequently asked questions

Do numeric XML attribute values need quotes?

Yes. XML requires quoted attribute values regardless of the value type.

Can XML attributes use single quotes?

Yes. Either matching single or double quotes can delimit an XML attribute value.

Why does similar markup sometimes work in HTML?

HTML parsing rules are more permissive in some cases. XML well-formedness rules require attribute quotes.

Debugging a specific XML issue? Browse XML troubleshooting.