element-name
is the name of the XML element. XML Elements names are case-sensitive i.e. when element starts with upper case letter, it should end with upper-case only. Likewise for lower case also.
attribute1 and attribute2
are element attributes which are partitioned by white spaces. An attribute provides single property of an element. It uses a name and value combination that are separated by equal "=" sign.
[xml]<a href="http://www.splessons.com/">SPLessons</a>[/xml]
In the above example, href is the name of attribute and http://www.splessons.com/ is the value of attribute.
Example - 1:
[xml]
<category>Programming</category>
[/xml]
Example - 2:
[xml]
<?xml version="1.0"?>
<contact-info>
<name>Mike</name>
<company>SPLessons</company>
<phone>+(011) 011223366</phone>
</contact-info>
[/xml]
Elements can contain text, sub-elements, media objects and attributes. Every XML document can have multiple elements inside it and the scope of them will be decided by the begin and end tags or by empty element. father-name
and mother-name
are added.
[xml]
<student>
<id>1</id>
<name>John</name>
<class>10th standard</class>
<father-name>Mike</father-name>
<mother-name>Rita</mother-name>
</student>
[/xml]