<?xml version="1.0" encoding="UTF-8"?>
<book-name type="technical">My XML Book</book-name>
<short-desc>This book is good for beginners in XML. This book helps beginners to learn xml easily and use XML concepts in their real development.</short-desc>
XML tags are similar as in html. If you have used html then it is easy to understand xml tags. Tag starts with < and ends with > characters. Tags can have attributes to provide information about tag.
These are of three types:
1. Start tag
2. End tag
3. Empty-element tag
This is also known as bodyless tag. It has a start tag but does not have a matching end tag.
Opening and closing tags collectively are called tag pair.
Xml tags follow some rules given below:
The content between start tag and end tag including tags is called element. An element can contain other child elements. Ex
1. XML Elements are Extensible.
2. XML Elements have Relationships as parents and children.
XML Naming Rules:
Any name can be used, no words are reserved but it must follow naming rules given below:
Xml elements can contain attributes which provides some additional information about element. For example, book-name element contains "type" attribute and it is assigned value "technical".
Attributes often provide information that is not a part of the data. Attribute values must always be enclosed in either single or double quotes. If the value of the attribute contains double quotes then use single quote to enclose the value of the attribute.
There are some problems using attributes as given below:
Posted on: October 30, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles