1

I often see XML documents with the xmlns attribute pointing to what appears to be an online resource - i.e. http://... or https://.... But going to these resources in a browser always returns errors.

What is the value of the xmlns attribute actually (if it's not a URI)? Alternatively, why can I not just access these resources by a browser?

=== EDIT

The best answer I've seen is here: In DTDs, why are namespaces given as a URL?

Community
  • 1
  • 1
Zach Smith
  • 8,458
  • 13
  • 59
  • 133
  • 1
    Also: http://stackoverflow.com/questions/16201678/in-dtds-why-are-namespaces-given-as-a-url – Quentin May 04 '17 at 14:41
  • And: http://stackoverflow.com/questions/14043391/do-default-namespaces-in-xml-really-need-a-uri – Quentin May 04 '17 at 14:41
  • Not to mention: http://stackoverflow.com/questions/18974378/what-does-namespace-uri-exactly-means – Quentin May 04 '17 at 14:42
  • And: http://stackoverflow.com/questions/38271786/why-are-xml-namespaces-http-addresses – Quentin May 04 '17 at 14:42
  • question. what would happen if you instead put a GUID in the namespace? or would the XML parse explicitly be wanting a URI schemed namespace? On that note, are both https and http allowed? – Zach Smith May 04 '17 at 15:01

1 Answers1

-1

The best answer that I found was to the question linked to above as 'duplicate'. However since the best answer (in my opinion) is not the accepted answer; here is a link to the answer I found most helpful (https://stackoverflow.com/a/5760645/3114742)

When you ask why a standard is the way it is, there are two possible interpretations of your question: (a) what are the perceived benefits of the design choice that was made, and (b) what was the historical sequence of events that led to this design being adopted over other designs.

Clearly, using HTTP-like URIs gives uniqueness. But that could also have been achieved in other ways, for example by inventing a new URI scheme. I think that if you trace the arguments that were made at the time, you will find that many of the people advocating the use of HTTP-style URIs were also advocating that namespace URIs should be dereferencable, perhaps to a schema or to some other kind of document. Indeed, it's W3C policy for its own namespaces that there is always a document that can be retrieved when you type the namespace URI into a browser, and that it should tell you something useful about the namespace.

So I suspect the fact that we use URIs that look deferenceable but don't define any semantics for what happens when they are dereferenced is in fact the result a committee compromise between two or more opposing camps. But you'd have to do some proper historical research to confirm that.

Zach Smith
  • 8,458
  • 13
  • 59
  • 133