XML Namespaces, XML Tutorial, Global Guideline

Forum | Blog


Basic XML Guide.       
 XML Introduction.       
 XML Tags Guide.       
 XML Attributes.           
 XML Syntax Guide.    
 XML Compilation.      
 XML Execution.          
 XML with CSS.           
 XML with XSL.            
 XML Data Island.        
 XML Professional.       
 XML with JavaScript. 
 XML Namespaces.
 XML CDATA.              
 XML Editors.               
 XML Summary.           


     Back             Next     
In XML we have an open opportunity to define our own tags.  As it is a great thing for use at the same time it would be tough task for us to explain some common tags on the application or display end that how to treat the similar or equal tags.  Equality mean, as we have an idea, that we mostly use of XML is web based then, web based applications follows the HTML conventions mean they recognize HTML tags and know how to operate or treat them and suppose some where else we use the same tag in XML that is defined in HTML then our application will fail to operate it as XML tag. 

The major example of this hurdle is that suppose we try to store some information of a patient in a medical clinic about his body and suppose we use <body> as for his information and the <body> tag is not allowed we can say, in XML so to avoid this kind of confliction we will use a technique that is called XML Namespaces to avoid confliction.
When we create new elements, there is the chance that the element's name already exists.
XML was designed to be a very weak markup language that could be used in many different applications. However, with XML being able to communicate between so many different platforms, there is one problem that tends to arise. Look at the below example of XML tag names confliction.

XML document without Namespaces

<?xml version="1.0" encoding="ISO-8859-1"?>
    <title>XML Tutorial, GGL Clinic</title>
  <b>Welcome to GGL Health Resource</b>

  <weight>180 ponds</weight>


Explanation of Without Namespaces issues

On the above example as we saw that there are two very different elements that want to use the same naming convention <body>. So the conflictions will occur when any application will compile or operate the above code. Now the solution to this problem is to create XML Namespaces, which will differentiate between these two similarly named elements. 

Example of XML Namespaces

<?xml version="1.0" encoding="ISO-8859-1"?>
<html:html xmlns:html='https://www.w3.org/TR/html/>
    <html:title>GGL Clinic</html:title>
  <html:b>Welcome to GGL Health Resource</html:b>

<clinic:body xmlns:clininc='https://www.globalguideline.com/xml>
  <clinic:weight>180 ponds</clinic:weight>


On the above XML Namespaces of clinic and html we have separated the both bodies, medical clinic and html. By placing a namespace prefix before our own and html elements we have re-solved the confliction now.

     Back             Next     

[ About ] [ Contact ] [ Home ]
[ Links ] [ Site Map ] [ Services ] [ Privacy ]

Copyright 2005 -  2022 www.globalguideline.com All rights reserved. (Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher) 284 visitors are online now