Skip to main content
HTML Validation

Bad value “X” for attribute “Y” on element “Z”: Not a valid XML 1.0 name.

About This HTML Issue

XML 1.0 names, typically used for the id attribute of elements, must comply with specific constraints, such as:

  • Must start with a letter or underscore _
  • Subsequent characters can be letters, digits, hyphens -, underscores _, and periods .
  • Cannot contain any spaces or special characters

Here’s an example of an invalid name for an ID:

<svg>
  <g id="Group 270">
<!-- Content inside the group element -->

  </g>
</svg>

This can be fixed by avoiding whitespace inside the name, like this:

<svg>
  <g id="group-270">
<!-- Content inside the group element -->

  </g>
</svg>

In this example, the id attribute value Group 270 has been changed to group-270 to follow the rules for XML 1.0 names.

Last reviewed: April 12, 2024

Was this guide helpful?

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Ready to validate your sites?
Start your free trial today.