Monday 15 January 2018

How to use a default namespace in XML

That a default namespace does not have a prefix. Now create an XML document, named defaultnamespace.xml to learn how to use a default namespace.


/////defaultnamespace.xml file////
<?xml version="1.0"?>
<root>
<table xmlns="http://www.namespace.com/furniture">
<name>African Coffee Table</name>
<width>80</width>
<length>120</length>
</table>
</root>

Here: root is the top most element that contains an instance of the table element. the table element uses the reference of a default namespace,
http://www.namespace.com/furniture, to avoid element name conflicts.

Shows the output of the defaultnamespace.xml file.



No comments:

Post a Comment