Tags, Nesting and Case Sensitivity
Going back to the first chapter, you leraned about HTML tags. In this section, you will learn how to make your own opening and closing tags, both for XML and HTML.
Tags
In the first chapter, you were able to learn a few HTML tags. In this chapter, you will make your own tags. The first rule that you have to learn in XML is that every opening tag must have a closing tag. For example, if you have:
<room>
then you must close it with:
</room>
In HTML, you may write code like this:
<p> This is a paragraph.
<p> This is another paragraph.
but in XML, you have to write code like this:
<para> This is a paragraph. </para>
<para> This is another paragraph. </para>
Always remember to close your tags in XML.
Nesting
When you make tags in XML, you have to make sure that they are properly "nested." What does it mean for tags to be properly nested? For example, in HTML, you can do this:
<b> <i> This text is bold and in italics </b> </i>
but in XML, you can't do that. You have to do this:
<b> <i> This text is bold and in italics </i> </b>
Make sure your XML tags are properly nested. Follow this guide:
<tagA> <tagB> <tagC> ... ... </tagC> </tagB> </tagA>
Always make sure your XML code has properly nested tags.
Case sensitivity
The next rule you must learn in XML is case sensitivity. If you make an XML tag like this:
<tree>
then make sure you close the XML tag with this:
</tree>
If you close your tag with
</Tree>
then there will be inconsistency in code.