XML = Extensive Markup Language
Consider below example
<bookstore>
<book category="children">
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="web">
<title>Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
<table>
<td>Apples</td>
<td>Bananas</td>
<table>
<h:table xmlns:h="http://www.w3.org/TR/html4/">
<h:tr>
<h:td>Apples</h:td>
<h:td>Bananas</h:td>
</h:table>
</bookstore>
Here,
1) Element = All the item with in <> is called Element
2) Attribute = Element may have the Attribute. Its contain data related to specifi element. Ex: "Category" is Attribut.
3) Attribute Value = Attribute have the value. Here, "children" is value of "Category" attribute. Here Attribute value should be with in double quotes.
4) NameSpace =
Its used to avoid Element Name conflicts.
So we add any prefix for differentiate the Same element name that is called Namespace.
The Namespace can be defined by an "xmlns" attribute in the start tag of an element.
The namespace declaration has the following syntax. xmlns:prefix="URI".
A Uniform Resource Identifier (URI) is a string of characters which identifies an Internet Resource.
Ex: Here xmlns:h="http://www.w3.org/TR/html4/" is namespace declaration and h is prefix of the element for diffrentiate the same element name.
Here the <table> element have duplicated. So we are using namespace and add the prefix for differntiate and declare for different meaning.
No comments:
Post a Comment