XML Syntax Rules
All XML Elements Must Have a Closing Tag
In HTML, elements do not have to have a closing tag:
<p>This is a paragraph
<p>This is another paragraph
In XML, it is illegal to omit the closing tag. All elements must have a closing tag:
<p>This is a paragraph</p>
<p>This is another paragraph</p>
Note: You might have noticed from the previous example that the XML declaration did not have a closing tag. This is not an error. The declaration is not a part of the XML document itself, and it has no closing tag.
XML Tags are Case Sensitive
XML tags are case sensitive. The tag <Letter> is different from the tag <letter>.
Opening and closing tags must be written with the same case:
<Message>This is incorrect</message>
<message>This is correct</message>
Note: "Opening and closing tags" are often referred to as "Start and end tags". Use whatever you prefer. It is exactly the same thing.
XML Elements Must be Properly Nested
In HTML, you might see improperly nested elements:
<b><i>This text is bold and italic</b></i>
In XML, all elements must be properly nested within each other:
<b><i>This text is bold and italic</i></b>
In the example above, "Properly nested" simply means that since the <i> element is opened inside the <b> element, it must be closed inside the <b> element.
XML Documents Must Have a Root Element
XML documents must contain one element that is the parent of all other elements. This element is called the root element.
<root>
<child>
<subchild>.....</subchild>
</child>
</root>
XML Syntax Rules
.
Categories
- ASP (4)
- HTML (4)
- JavaScript (4)
- PHP (4)
- Visual Basic (4)
- XML (5)
Popular Posts
-
The following console program is the Visual Basic version of the traditional "Hello, World!" program, which displays the string ...
-
change button color in visual basic Public Class Form1 Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows...
-
XML Attribute Values Must be Quoted XML elements can have attributes in name/value pairs just like in HTML. In XML, the attribute values...
-
A message box when page opens (Javascript Code) You can bring a message box or a alert a window which tell something to user at the first ...