File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes XML namespace - what is purpose? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML namespace - what is purpose?" Watch "XML namespace - what is purpose?" New topic

XML namespace - what is purpose?

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1599
What are xml namespaces? and why is that we often use URLs in them?

I created

and opened it in IE. I did not get any complaint from the browser that is invalid namespace or anything such.

I was expecting that I get some error stating either I have some wrong URL or my xml is not properly formed as per the URL, as I have not placed any DTD/XSD or anything on that URL.

If there is no link between the URL and the XML then what is the purpose of having XML namespace?

Also my other question is that do I need to be connected to internet for non-local URLs in namespaces?

Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
A namespace identifier is not an URL, it is a URI - a very important distinction! As such it does not need to be related to an actually existing domain (although that may sometimes make sense), nor can it be verified in any way by making a network call. A namespace serves to uniquely identify element names, so that it's possible to have XML documents like this:

and it's always clear which "foo" element is meant - the two may be very different in meaning!
I agree. Here's the link:
subject: XML namespace - what is purpose?
It's not a secret anymore!