XML - Comments in Hindi




एक comment का उपयोग notes leave या अस्थायी रूप से XML कोड के एक हिस्से को संपादित करने के लिए किया जाता है हालांकि XML को self-describing करने वाला डेटा माना जाता है, लेकिन फिर भी आप कुछ ऐसे उदाहरण देखोगें जहां पर एक XML comment की आवश्यकता हो सकती है।

XML comments किसी अन्य प्रोग्रामिंग भाषा की तरह programmers के लिए XML कोड की readability को बढ़ाने के लिए और annotations या comment को जोड़ने के लिए उपयोग में लाये जाते है comments को एक XML दस्तावेज़ में कहीं पर भी रखा जा सकता है।

XML Comment Syntax

Example Code

<?xml version="1.0" encoding="ISO-8859-15"?>
<!-- Students grades are updated bi-monthly -->
<class_list>
	<student>
		<name>John</name>
		<grade>A+</grade>
	</student>
	<student>
		<name>Michael</name>
		<grade>A-</grade>
	</student>
</class_list>

XML Comments Rules

  • XML declaration से पहले comment का उपयोग नहीं किया जा सकता

  • CDATA के भीतर comments processed नहीं हैं।

  • Attribute value के भीतर comment का उपयोग नहीं किया जा सकता।

  • किसी comment के अंदर comment करने का कोई अर्थ नहीं इसका मतलब यह हुआ किसी भी comment के अंदर comment नहीं करना चाहये।