XML Comment
A comment is used to leave a note or to temporarily edit out a portion of XML code. Although XML is supposed to be self-describing data, you may still come across some instances where an XML comment might be necessary.XML Comment Syntax
XML comments have the exact same syntax as HTML comments. Below is an example of a notation comment that should be used when you need to leave a note to yourself or to someone who may be viewing your XML.XML Code:
<?xml version="1.0" encoding="ISO-8859-15"?>
<!-- Students grades are updated bi-monthly -->
<class_list>
<student>
<name>Robert</name>
<grade>A+</grade>
</student>
<student>
<name>Lenard</name>
<grade>A-</grade>
</student>
</class_list>
XML Commenting out XML
For many different reasons, sometimes you might want to temporarily remove some XML code from your XML document. XML Comments let you do this easily, as this example below shows.XML Code:
<?xml version="1.0" encoding="ISO-8859-15"?>
<class_list>
<student>
<name>Robert</name>
<grade>A+</grade>
</student>
<!--
<student>
<name>Lenard</name>
<grade>A-</grade>
</student>
-->
</class_list>
0 comments:
Post a Comment