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 8601795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:55:37+00:00 2026-06-12T01:55:37+00:00

Is there any particular reason (other than it would make the parsing harder) that

  • 0

Is there any particular reason (other than it would make the parsing harder) that XML doesn’t allow nesting comments, i.e. something like

<!--
  <!-- this is the foo element -->
  <foo>bar</foo>
-->

?

  • 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-06-12T01:55:38+00:00Added an answer on June 12, 2026 at 1:55 am

    Presumably, it’s for the same reason that you can’t nest tags:

    <tag1 <tag2>foo</tag2>>  <!-- This won't work. -->

    A comment is really just one kind of tag, and the same rules apply to comments as to any other tag.

    Update: Quentin properly points out that a comment is, in fact, not a tag. It’s a different thing altogether. What is true, though, is that comments follow the same delimiter-content-delimeter pattern that tags do. Compare the rule for comments (15) to the rule for empty tags (44) and the rules for start tags (40, 41), and contrast those with the rule for elements (39). Elements can be nested (43), but an element is (back to 39) a start_tag-content-end_tag combination where the content part can be an element. A comment, again, works like an individual tag, not like an element.

    Now, all that explains that comments can’t be nested, but not why it was designed that way. I don’t know enough about the history of XML to say what was in the hearts of its designers, but XML is “an application” of the even more general SGML. It was also developed well after the introduction of HTML and was intended in part to address some of the flaws in HTML. SGML and HTML share the same syntax for comments, and it’s obvious just by looking that XML inherited that same syntax. One has to imagine, then, that XML comments work they way they do largely because they were inherited from its predecessors: the decision had been made before XML development even got underway.

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

Sidebar

Related Questions

Is there any particular reason that all data members in a class are private
Is there any particular reason to use one over the other? I personally tend
Is there any particular reason to use one over the other or it's all
Is there any particular reason that the linking phase when building a project with
Is there any other command for redirecting a controller to a particular view page
Is there any way to ensure that a class posts a particular NSNotification? (I
Is there any particular reason? Is it not possible at all or is it
Is there any particular reason (performance or otherwise) to use AS ahead of =
Is there any reason in particular why it's recommended to run memcached on a
Is there any particular way to integrate Captch code validation in iPhone application? is

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.