XML Tutorial - 02 - Syntax Rules I


Uploaded by ProgrammingVideos on 05.10.2008

Transcript:
To make an XML document we can create a text file and give it an xml file extension.
The first line in the document must be the XML declaration. It defines the XML version
and the character encoding used in the document.
This XML document will describe a book, so we'll start by creating a tag called .
Just like in XHTML the tags are recognized by the angle brackets and all tags must have
a closing tag, except for the XML declaration.
Unlike HTML, XML tags are not predefined so we create our own tags. Any names can be used,
but they shouldn't contain spaces or start with numbers or punctuations. We can use both
upper or lower case as long as the opening and closing tags use the same case.
This first element is called the root element and each XML document can have only one of
them. Inside it we'll add two child elements -
and <chapter>. These are sister elements to each other because they have the same parent<br /> element - <book>. All elements can contain both text and children elements like this.<br /> <br /></div> </div> <div class="skyscrapper - squares" align="right"> <br /> <br /> <br /> <br /> </div> </div> </div> </div> <div align="center" style="font-size: 14px"> </div> <!-- Yandex.Metrika counter --> <script type="text/javascript"> (function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter17905993 = new Ya.Metrika({id:17905993, enableAll: true}); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f); } else { f(); } })(document, window, "yandex_metrika_callbacks"); </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-38545247-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <noscript> <div><img src="//mc.yandex.ru/watch/17905993" style="position:absolute; left:-9999px;" alt="" /> </div> </noscript> <!-- /Yandex.Metrika counter --> </body></html>