XML क्या है ? part 2

XML Syntax & Commenting

XML क्या  है ?  part 2
XML क्या  है ?  part 2

 

Introduction to XML syntax 
XML syntax 2 तरह की information को show करता है। एक तो markup information होती है। जो tags के द्वारा show की जाती है। दूसरी text information में होती है जो की tags के बीच में real data होता है। Markup information text information को define करती है। Markup information किसी meta data की तरह होती है।

XML का syntax बहुत ही easy और readable है। बस आपको एक बार इसे समझने की आवश्यकता होगी और फिर बाद में आप शायद ही कभी इसे भूलें। 

आइये XML से related सभी elements के syntax और functions के बारे में जानने का प्रयास करते है। 

XML declaration 
XML declaration से XML processor को XML document को process करने से पहले उसके बारे में information मिल जाती है। XML declaration optional होता है। जब भी आप XML declaration यूज़ करे तो ध्यान रहे की ये आपके document की पहली line होनी चाहिए। 

XML declaration से end किया जाता है। XML declaration के 3 attributes होते है। इनके बारे में निचे दिया जा रहा है। 

Version - ये attribute document में यूज़ किया गया XML का version define करता है। इसकी regular value 1.0 होती है।    Encoding - ये attribute document में यूज़ की गई character encoding define करता है। इसकी regular values UTF-8, UTF-16 और EUC-JP आदि हो सकती है। Standalone - ये attribute parser को बताता है document standalone है या DTD पर depend करता है। इस attribute की regular values ये और no होती है।  

XML declaration के लिए कुछ rules follow किये जाते है। इनके बारे में आपको पता होना चाहिए। ये निचे दिए गए है।

यदि XML declaration include किया गया है तो उसमे version number जरूर होना चाहिए। बाकी attributes को आप चाहे तो ignore कर सकते है। Attributes के name और values case sensitive होती है। Attributes के names हमेशा lower case में होने चाहिए। आप double quotes की जगह single quotes भी यूज़ कर सकते है। 

XML declaration के 2 उदाहरण निचे दिए जा रहे है।

Share this

Related Posts

Previous
Next Post »

please comment your choice game ...