Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating an XML namespace without a domain

Usually tutorials tell you to use your own domain name when making a new XML namespace. Not everybody owns a domain, it costs money, and the site might be unrelated to the purpose that you are using the XML for.

What is a good alternative?

In this answer, the example just has some_identifier, however Wikipedia says it is a URI. URIs can be URLs or URNs.

URLs can provide a link to the schema, however the primary purpose of the namespace is to be a unique identifier, so a URN fits better.

How do you generate a unique identifier? UUIDs are good for identifiers, so I searched and there is even an example on W3C:

<?xml:namespace ns='urn:uuid:C4ED1820-6207-11d1-A29F-00AA00C14882/'
                src='http://www.w3.org' prefix='w3c' ?>

Why don't people use UUIDs more often? What are the disadvantages of UUID namespace or advantages of a domain-based namespace? If your domain expires you might lose it and have to change all your namespaces.

like image 419
user868538 Avatar asked Oct 21 '22 13:10

user868538


1 Answers

There is no connection except by happenstance between a DNS domain name and an XML namespace.

If you have a DNS domain name and want to use it in your XML namespace, you can. If you do not have a DNS domain name or do not want to use it in your XML namespace, that is fine too.

UUIDs are not typically used for XML namespaces because they are not very meaningful - similar to typically using host & domain names over IP addresses.

like image 58
J0e3gan Avatar answered Oct 23 '22 04:10

J0e3gan