1

For example,

<svg xmlns="http://www.w3.org/2000/svg">
  <!-- more tags here -->
</svg>

Can we use something shorter, such as svg2000, svg1.1, or w3svg2000, instead of a long url "http://www.w3.org/2000/svg", which is too long to type and typo-prone?

According to this answer,

'These URLs are not used for connecting to, they just define what the elements mean'

Why do W3C and major browser companies insist on using something cumbersome?

J.Joe
  • 644
  • 2
  • 7
  • 20
  • 2
    The namespace should be *globally* unique. This is easiest if you start with something you own (eg. a domain). Additional a URI that can be dereferenced can point to further information. Finally: 27 characters isn't long. – Richard Aug 29 '17 at 05:51
  • @Richard: "easiest if you start with something you own (eg. a domain)" - of course, that is a matter of perspective. In my open source/freeware software development, I have more than once faced the dilemma of having to choose a URI while *not* owning a domain that I know I will still have 5 years from now (not only because of payments, but primarily because I can't be sure no-one will have me give up the domain because they can lay a stronger legal claim on the name than I can ... unless I use my real name, which feels both silly and presumptuous to have in all of my software's documents). – O. R. Mapper Aug 29 '17 at 05:59
  • The major browsers insist on doing what w3c says so they are interoperable. If you use html you don't need namespaces at all. – Robert Longson Aug 29 '17 at 06:08
  • 1
    XMPP basically does what you describe - it uses namespaces such as `jabber:client`, although later it switched to URNs like `urn:ietf:params:xml:ns:xmpp-tls`. – el.pescado - нет войне Aug 29 '17 at 06:24
  • 1
    BTW. complaining about verbosity of namespaces in XML-based format... – el.pescado - нет войне Aug 29 '17 at 06:26

2 Answers2

1

Can we use something more shorter, such as svg2000, svg1.1, or w3svg2000, instead of a long url "http://www.w3.org/2000/svg", which is too long to type and typo-prone?

That depends on what you're asking. If you're designing your own format, you can pick whatever namespace you want. For example, pre-XMPP Jabber used jabber:client and jabber:server namespaces (though, as Jabber progressed into XMPP it switched to URNs like urn:ietf:params:xml:ns:xmpp-tls).

Why do W3C and major browser companies insist on using something cumbersome?

If you want to implement existing standard, such as SVG, then you have to play by its rules, and XML namespace is part of SVG standard. If you use different namespace, then your document is no longer a SVG document.

BTW:

long url "http://www.w3.org/2000/svg", which is too long to type and typo-prone

You shouldn't be typing it, and certainly not more than once:)

  • 1
    "If you want to implement *existing* standard, such as SVG, then you have to play by its rules" - I think that part of the question was asking why organisations that participate in developing said standards choose a lengthy namespace in the first place. – O. R. Mapper Aug 29 '17 at 08:43
0

For a short answer, see Michael Kay's answer to a similar question. For a long version read on...


The XML Namespaces specification itself does not mandate the use of such long URLs:

The namespace name, to serve its intended purpose, SHOULD have the characteristics of uniqueness and persistence. It is not a goal that it be directly usable for retrieval of a schema (if any exists). Uniform Resource Names [RFC2141] is an example of a syntax that is designed with these goals in mind. However, it should be noted that ordinary URLs can be managed in such a way as to achieve these same goals.

...so the W3C specs, including SVG, could have used a shorter name, like urn:w3c:svg.

However, as noted in Architecture of the World Wide Web, using a URL as the namespace name allows (while still guaranteeing uniqueness) publishing a "namespace document" with information about the namespace. The shortest name that doubles as a URL would be http://w3.org/svg

(The value of a namespace URL pointing to a "namespace document" seems low in today's world where no-one can imagine life without a search engine like Google, but you can try to understand people in 90s not relying on a search engine for the architecture of the web.)

There are many working groups at W3C (most working on relatively obscure topics), so they came up with a policy for allocating namespace URLs of form http://www.w3.org/YYYY/MM/ssss. The policy includes a rationale:

  • for keeping "www.": "to duplicate the site at both addresses [with and without the www. prefix] would trash the efficiency of caches, indexes and archives all over the world." - heh
  • for YYYY and MM (digits corresponding to the year and month of URI allocation): "This syntax enables the W3C support staff to ensure very high level of persistence for namespace URIs ... Group participants should bear in mind that the W3C Team will be maintaining this Web space long after the groups have become more interested in other topics or have been closed."

Later the policy was amended to allow year-less URLs (http://www.w3.org/ns/ssss), but it was too late for SVG.

As an interesting historical aside, the "Origin and Goals" of the XML specification states, "Terseness in XML markup is of minimal importance" - which is said to be a result of "the complexity and difficulty of SGML [...] greatly increased by its use of minimization." But in the end, the attempt to switch the web to XML failed and as of today, the standards allow using SVG inside HTML without specifying namespaces.

Nickolay
  • 31,095
  • 13
  • 107
  • 185