Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the significance of namespaces in xml?

Answer Posted / g.h

The true name of an XML element or attribute is not just the
string you see in its text form. It actually consists of
that "local" name combined with the namespace URI. This
combination forms the "qualified name".

Take a look at the following two XML extracts:

<quantity>5</quantity>

<edi:quantity
xmlns:edi='http://ecommerce.example.org'>5</edi:quantity>

Both are "quantity" elements. Both have the same content.
However, the second element is defined within a namespace
scope. Its fully qualified name consists of the namespace
URI (http://ecommerce.example.org) and the local name
(quantity). Mind that the "edi" prefix is of no consequence;
it only serves to bind the element to the namespace.

If both these elements were used in the same XML document,
they would in fact not be equivalent. Namespaces can serve
to create elements with the same local names but with a
different meaning. This is important when mixing XML data
from different contexts, while the meaning of each part must
be maintained.

An example of such a mixed environment is XML embedded in
web pages. Suppose we created a page in XHTML. A part of
this page might consist of an XML document, perhaps with its
own associated stylesheet. Suppose that XML document
contained an element with local name "table". If the web
browser used to view the page just read all markup it
recognized, it would try to interpret that element as a HTML
table. However, in the context of the XML document, the
table tag might have a totally different meaning. It might
in fact model a database table.

A way to solve this would be to use the XHTML namespace as
the default namespace for the web page. The XML document
could then explicitly use the XML namespace. An XHTML and
XML compliant web browser would then only interpret the
elements in the XHTML namespace as HTML markup, using only
these to format the page. The XML document would be handled
in its own way, possibly using a stylesheet.


In short, namespaces are used to allow different XML
vocabularies to be mixed without creating conflicts of meaning.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can xml tags have spaces?

796


Why was xml developed?

775


How do I open an xsl file?

868


Can multiple xml namespace declarations be in scope at the same time?

902


What is xml simple definition?

818


What are the condtions that apply in case of xsl:stylesheet element?

810


What is difference between xml and xaml?

891


Write syntax to serialize class using XML Serializer?

886


How do I use graphics in xml?

821


Is xml a language?

819


XML serialization ?

1831


What is xml web service?

747


Who founded xslt?

823


What is the difference between csv and xml?

816


Write a code for xml attribute and element.

842