Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6600519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:38:00+00:00 2026-05-25T18:38:00+00:00

I want to validate XML templates that are a XHTML extension. Now there are

  • 0

I want to validate XML templates that are a XHTML extension. Now there are special characters like { and | in ID attributes. Is it possible to extend the XHTML DTD to overwrite the restriction to the characters allowed in the ID attribute? Or are the characters defined by the XML specification?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:38:01+00:00Added an answer on May 25, 2026 at 6:38 pm

    You cannot use the characters ‘{‘ and ‘|’ directly in id attributes because in the XML specification it says

    Values of type ID must match the Name production. A name must not appear more than once in an XML document as a value of this type; i.e., ID values must uniquely identify the elements which bear them.

    The name production is here. If you expand the syntax rule you see that the only characters allowed in a name are given by these productions:

    [4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]

    [4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]

    Unfortunately the left brace and the pipe are not allowed. The codepoints for those characters are #7B and #7C respectively; not in the accepted character ranges.

    TL;DR: the legal characters for ID attributes are owned by the XML spec and your two characters are not legal.

    ADDENDUM

    Here are some examples. The following document passes validation for XHTML on the W3C validation site:

    <?xml version="1.0"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
      <head>
        <title>A title</title>
      </head>
      <body id="anid">
      </body>
    </html>
    

    but the following will not

    <?xml version="1.0"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
      <head>
        <title>A title</title>
      </head>
      <body id="ani{d">
      </body>
    </html>
    

    We get the error:

    Line 8, Column 16: character "{" is not allowed in the value of attribute "id"
    

    Now it’s rather interesting that if you really want the left curly bracket in the id name, you can try this:

    <?xml version="1.0"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
      <head>
        <title>A title</title>
      </head>
      <body id="ani&#x7B;d">
      </body>
    </html>
    

    But you get the same error! You might want to try this; the validator shows the line with the ampersand hash x seven b semicolon but it thinks there is a left brace there.

    The bottom line is that you simply cannot have ids with characters other than those allowed by the XML specification.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to validate xml against xsd file. So I would like to install
I got a simple XML file that I want to validate against an XSD.
Is it possible to define in XML schema that there must be some certain
Does there exist an Xml schema that will validate other XML schemas? What I
I want to validate an XML file against an XML Schema file. It is
Very basic question- I've a xml file and I want to validate it against
I want to validate a registration form that accepts an email address in the
If I want to validate that a text box contains an integer greater than
I want to validate an XML file against an XSD schema. The XML files
In soapUI Pro I want to create an assertion to validate specified XML node

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.