0
XML – Extensible Markup Langauage
Its more suitable as
data representation choice when software element need to communicate with each
other.
Let review the XML basics with an example
anurudh@anurudh:~/newfolder$ cat ex1_xm.xml
<device>
<vendor>Cisco</vendor>
<model>7600</model>
<version>IOS 15.6</version>
</device>
Here <device> is root , which is present in outermost XML tag of document , also referred as parent of the element <vendor>,<mode> and <version> , whereas <vendor>,<mode> and <version> is known as children of the parent element <device>.
Namespace : Its part of XML Specification to differentiate between different XML blocks having same names
let’s take an example , if I have one more xml document as below
<device>
<vendor>Cisco</vendor>
<model>9600</model>
<version>IOS 15.6</version>
</device>
Here , the only
difference between earlier XML doc and this one
is one element i.e model number changed from 7600 to 9600 ,but parent
element is same in both XML doc i.e <device> So there should be method to
avoid conflict , there comes NAMESPACE which prevent element naming conflict
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”.
<root>
<a:device xmlns:c="http://example.org/7600devices">
<a:vendor>Cisco</a:vendor>
<a:model>7600</a:model>
<a:version>IOS 15. Continue reading