XML Tags
As was mentioned quickly in the XML Element Lesson, XML tags signify the opening and closing of an element. The two types of tags are:- Opening Tag - <element>
- Closing Tag - </element>
A Tag Pair
The opening and closing tags are referred to as a tag pair. All data that belongs to a specific element will be appearing within this tag pair.The Solo Tag
In addition to the standard tag pair, there are elements that contain no text. This means the tag pair can be substituted with a modified opening tag. You may have seen these types of tags in HTML before.- Modified opening tag - <element />
The Tag Ordering Rule
Every XML tag must be closed in the order that it was opened. If an XML tag was opened inside another element, then it must be closed before the outer element can close. If this rule is not obeyed, an XML processing error will occur. Below are examples of good and bad XML documents. Try to figure out which are valid XML and which violate a rule.XML Code 1:
<email> <to>A. Nony Mouse</to> <body>Hey There!</body> </email>
XML Code 2:
<email> <to>A. Nony Mouse <from>Bobby</to></from> <body>Hey There!</body> </email>
XML Code 3:
<email> <to>A. Nony Mouse</to> <from>Bobby</from> <body>Hey There!</body> </email>
0 comments:
Post a Comment