I am really confused on how namespaces work.
Specifically, I read that the URI assigned to the prefix is not parsed.
If so, then what is the point of indicating a URI?
I am really confused on how namespaces work.
Specifically, I read that the URI assigned to the prefix is not parsed.
If so, then what is the point of indicating a URI?
The namespace URI is for all formal and practical purposes the name of the namespace; it needs to be distinct from the URI of unrelated namespaces, and the only meaningful operation is comparing it with another namespace URI.
There's a popular (but obviously not universal) tradition of choosing for a namespace URI a working HTTP URL for a XML Schema document defining elements in that namespace, but it is only an informal convention which doesn't affect the actual rules for either namespaces or schemas.
If you look at the W3C's documents, you'll find some of the history of this. Basically, URIs were chosen for the same reason reverse-domain-names are often used for project names in Java: they aren't inherently meaningful, but they do provide some hint about who created them and what they might mean, and we already have practices in place to ensure against their being unintentionally reused (which could cause malfunctions.)
Back in the early days of Namespaces, we were using URLs as namespace names. It was generalized to URIs later (after the decision was made that the namespace name didn't necessarily point to anything), but many of the issues were specifically phrased in terms of URLs so my discussion's going to mainly reflect that subset of URI space.
There was at one point an intent that namespace names might be more meaningful. Tim Berners-Lee wanted them to point to someplace that provided additional information about the node types bound to that namespace -- not just a schema but an entry into his "Semantic Web" concept. That seems to have been dropped; I haven't heard much about the Semantic Web in years, at least not on more than a much-simplified and far-more-local level.
There was also an attempt to define behavior for relative URLs as namespace names. After much debate, TB-L conceded that this really didn't have workable semantics either, and the W3C declared that all namespace names should be formatted as absolute URLs or URIs and compared simply as strings. (More officially phrased: The use of relative URLs as namespace names is Deprecated until and unless someone comes up with a strong reason to use them. Individual tools may not check this, but documents using relative URLs as namespace names are Not Portable so you're very, very strongly advised to avoid them.)
If you are indecently lucky and/or whoever developed this document type is still trying to leverage the Semantic Web concept, there may be additional information about the namespace available at that URI. (That is, it may actually be functioning as a Uniform Resource Locator rather than just as a Uniform Resource Identifier.) But as far as the standards go right now, there's no promise that this point in URI-space is occupied, or what can be found there if so. Basically, dereferencing a namespace name is an undefined operation.
It really is simpler, and more correct for now, to just treat the Namespace Name as a string that must be formatted as an absolute URL or URI for uniqueness' sake.
(I used to have a pointer to an excellent document which explained this more clearly and more officially, but it's been years since anyone has asked me this particular question and I've misplaced it. If I find it, I'll update this answer.)
The namespace prefix defines how the XML tag name is to be intrepreted. Presumably, the author of a namespace has defined a schema for interpretation. The namespace also avoids name conflicts when an XML document is constructed from more than one source, where each source uses the same tag name but for different meanings.
Below is a link to the W3C school tutorial on XML namespaces: http://www.w3schools.com/xml/xml_namespaces.asp
The point is to have something readable, saying and unique. Creator can set URI to some folder on his company site.
CONSIDER ALTERNATIVES
just names
Actually they already are just names. It is only recommendation to use URIs. Names have a problem of collisions (non-unique). Also, names can be not saying if somebody wish to name his file format as superpooper
.
dot-notated hierarchical names, like packages in Java and C#.
It's actually the same as URIs, but can probably contain collisions when many bodies wish to have the same name like com.super.pooper.format
.
GUID
GUIDs are absolutely unique, but not readeable and not saying. What this can mean {000209FE-0000-0000-C000-000000000046}
?
So, creators of XML invented to reuse the results of already done work. Most bodies already have their web-sites. Which means that they already have chosen readable names and folder structure which is unique enough.
This is brilliant idea I think.
But you can ignore this idea and name your namespace as AAA
.