1

I use XML for configurations but sometimes I want to test new ones and use comments to leave them separated from the rest like this:

<!-- Begin testing block comments -->
<test1>
    something here
</test1>

<test2>
    something else
</test>
<!-- End testing block comments -->

So recently I came across an error after commenting the whole block removin the first closing comment, assuming that it works as C block comments where only the first comment opening is regarded until a closing one is found (i.e. /* /* */). But when I did the following:

<!-- Begin testing block comments >
...
<!-- End testing block comments -->

I still came across configuration errors. Will this mis-comment my code or is it suppose to work like this? Because if it is I suppose something else might have happened...

1 Answer 1

2

From the specification:

Comments may appear anywhere in a document outside other markup; in addition, they may appear within the document type declaration at places allowed by the grammar. They are not part of the document's character data; an XML processor may, but need not, make it possible for an application to retrieve the text of comments. For compatibility, the string " -- " (double-hyphen) must not occur within comments.

You have such a double-hyphen here:

<!-- Begin testing block comments >
...
<!-- End testing block comments -->
  ^^
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.