Detailed description of the code comment writing method in XML

Source: Internet
Author: User
This article mainly introduces the code annotation writing method in XML, and summarizes some notes for using annotations, such as XML does not support nested annotations, for more information about how to write code annotations in XML, see the next article. The article summarizes some notes for using annotations, for example, XML does not support nested annotations, for more information, see

XML and HTML annotations are similar. Annotations are used to add instructions or understand a line of XML code.

Annotations can be used to contain related links, information, and terms. They are only visible in the source code, rather than in the XML code. Annotations can appear anywhere in the XML code.

Syntax
Shiji End, for example .
Annotations can appear in the document's preface, including document type definitions (DTD); after a document; or in text content. Annotations cannot appear in attribute values. It cannot appear in the tag.
When the analyzer encounters>, it considers that the comment has ended; then it continues to process the document as a normal XML. Therefore, strings> cannot appear in comments. In addition to this restriction, any valid XML characters can appear in comments, which is very similar to the CDATA section. In this way, you can delete XML comments from the output stream seen by the analyzer without deleting the document content.
The following annotations can be used to temporarily remove tags.

Example
The following is an example of using annotations in an XML document:

 
 
     
          
   
    Tanmay
           
   
    A
       
  
 

Note:

The text between characters is considered as comments. # Below are the rules for XML annotations:
-Annotations cannot appear before the XML declaration.
-Annotations can appear anywhere in the document.
-Annotations cannot appear in attribute values.
-Annotations cannot be nested in other annotations.

In HTML, you can use annotations to hide scripts and style sheets. To use this method in XML, you may have to retrieve comments, extract comments, check whether there are markup characters, and re-analyze them. In this example, the CDATA section is a better choice.

The above is the detailed description of the code comment writing method in XML. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.