Saturday, April 2, 2011

XML Namespaces

Among the few robust markup languages designed, XML includes to be a language which can be used in various ways and for many different applications. However, with more and more usage of XML in many different platforms it has encountered with one problem that tends to occur with majority of problems in namespace. At such juncture, XML namespaces comes into picture. Now what are XML namespaces and what are its uses. XML Namespaces are methods and ideas which are used to avoid element name conflicts which tend to create problems. Thus they play a pivotal role in rendering uniquely named elements and attributes in an XML document.

Now how is the XML Namespaces defined, they are defined in a W3C recommendation. An XML instance may comprise of attribute or element names from more than one XML vocabulary. So with such case, if each vocabulary is given a namespace then the ambiguity between identically named elements or attributes can be resolved. A simple example can be if you consider an XML instance that contained references to a customer and an ordered product. Both the product element and the customer element could have a next generation id or in other words child element named id. So putting their references to these id elements can be confusing and perplexing, thus the need of placing them in with different namespace can avoid this confusion and thus remove the ambiguity.

Now what are these namespace called? These namespace are commonly known as uniform resource identifier which is usually denoted as URI. Generally, these URI chosen for the namespace of a given XML vocabulary defines a resource under the control of the designer or author or the organization defining the vocabulary, such as a URL for the author's Web server. However, the namespace specification does not require nor suggest that the namespace URI be used to retrieve information; it is simply treated by an XML parser as a string. For example, the document at http://www.w3.org/1999/xhtml itself does not contain any code. It simply describes the XHTML namespace to human readers. Using a URI (generally the links like "http://www.w3.org/1999/xhtml") to identify a namespace, rather than a simple string (such as "XHTML"), reduces the prospects of diverse namespaces using duplicate identifiers.

However, this very term of XML Namespace is quiet popular, and commonly used, the W3C Recommendation refers to it as the namespace name. The specification is not entirely prescriptive about the precise rules for namespace names (as it does not explicitly say or define that parsers must reject documents where the namespace name is not a valid Uniform Resource Identifier), and many XML parsers allow any character string to be used. In version 1.1 of the reference, the namespace name becomes an Internationalized Resource Identifier, which licenses the use of non-ASCII characters that in practice were already accepted by nearly all XML software. The term namespace URI persists, however, not only in popular usage but also in many other stipulations from W3C and elsewhere.

After the publication of the Namespaces recommendation, we saw an extensive and intensive debate about how a relative URI should be used and handled, with some arguing that it should simply be treated as a character string, and others argue that it should be turned into an absolute URI by resolving it against the base URI of the document. The result of the debate was a ruling from W3C that relative URIs were deprecated to the masses.

The use of URIs taking the form of URLs in the http format (such as http://www.w3.org/1999/xhtml) is popular, despite the absence of any formal relationship with the HTTP protocol. The Namespaces specification does not say what should happen or work if such a URL comes with dereferences which means, if the software attempts to retrieve a document from this location. One method or convention adopted by some users is to place a RDDL document at the location. So in other words generally speaking, the users should assume that the namespace URI is simply a name, not the address of a document on the web.

After all the above discussion about the XML namespace, the question arises is to how actually this markup language is used or applied. XML namespaces is a special type of reserved XML attribute that you place in an XML tag. The reserved attribute is actually more like a prefix that you attach to any namespace you create. This attribute prefix is "XMLNS:", which stands for XML namespace. The colon is used to separate the prefix from your namespace that you are creating. The following are the methods of writing XML namespace.

XML Code:


<? xml version="1.0" encoding="ISO-8859-15"?>
<html:html xmlns:html='http://www.w3.org/TR/xhtml1/'>
<html:body>
<html:p>Welcome to my Health Resource</html:p>
</html:body>
<health:body xmlns:health='http://www.example.org/health'>
<health:height>6ft</height>
<health:weight>155 lbs</weight>
</health:body>
</html:html>



So by using a XML Namespace you can actually avert all the issues related to attribute naming and the overlapping problem. So don’t feel inquisitive, just feel free to check them out the W3C's Namespace Document for a very in-depth look at XML namespaces and enjoy hassle free applications.

Popular Posts

Tajuddin Baba Life Story | Bank Exam coaching Classes in Nagpur | IBPS exam Coaching Classes in Nagpur | SSC-CGL Coaching Classes in Nagpur | MBA-CET Coaching Classes in Nagpur | Campus Recruitment Training in Nagpur | Bank Exam Coaching Classes Nagpur | Penile Prosthesis in India | Urology Surgery Treatment in India | Diabetes cause Impotence Treatment India | Urology Blog India | Phalloplasty Surgery in India | Types of Penile Implants | Top Urologist Surgeons in India | Peyronie Disease | ED1000 | Urethroplasty Surgery in India | Inguinal Hernia Surgery in India | Fibroid Removal Surgery in India | Myomectomy Surgery in India | ED Treatment in India | Diabetes cause Impotence Treatment India | Ask The Doctor | Penectomy Surgery India | Artificial Urinary Sphincter Surgery in India | Premature Ejaculation | Robotic Prostatectomy Surgery in India | Radical Prostatectomy Surgery in India | UrologyCare INDIA | Alexis Hospital Nagpur | Mobile Tips Tricks | Google SEO Rules

Fibroid Removal Surgery in India : Low cost fibroids treatment in India is an efficient way to get rid of uterine fibroid that develop on the outer walls of the uterus. This treatment is available at all hospitals of Indian metro cities.

Penile Prosthesis Surgery : Get safe Penile Prosthesis Surgery in India done by fully qualified doctors in India.You can now enjoy a fully satisfying sex life by eliminating impotence.

Robotic Prostatectomy Surgery in India: Robotic prostatectomy surgery is a robot-assisted laparoscopic radical prostatectomy. EDTreatmentIndia is a leading medical tourism service provider for Robotic prostatectomy surgery in India.

Radical Prostatectomy Surgery in India : Get your Laparoscopic Radical Prostatectomy in India under best surgeons of the country

Urinary Incontinence Surgery in India : EDTreatmentIndia lists clinics around the world offering Urinary Incontinence Treatment procedures from 0. Save up to 80% on Urology treatment in India.

Best Urology Surgery and Treatments Hospital in India : Looking for the list of best Urology Hospitals in India. Urology treatment in India. within your budget. Contact Us at EDTreatmentIndia for the right guidance.

Urethroplasty Surgery in India : LOW COST Urethroplasty Surgery In India with EDTreatmentIndia for Urethra problems from the best urethroplasty surgeons in India

Rice Exporter in India: We are one of the leading exporters of Basmati Rice and Non Basmati Rice marching ahead with premium quality of international standards. We are known as a Vishnu Rice Mill

Free Online PSD Template Download: Web templates PSD for free. Download now and use them for personal and commercial use, PSDOO Provide thousands of free graphic resources available for you.

Bank PO Coaching Classes in Nagpur Banking Coaching Centers in Nagpur Maharastra about bank and other government jobs With CareerCampus

Farmhouse in Nagpur : Find farm house for sale in Nagpur within your budget - Get best deals on all type of Farm House in Nagpur with Shubham Farms