Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when to use a URN for xmlns

For a "hello world" type xml document:

<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.w3.org/TR/REC-xml-names/ -->
<bk:book xmlns:bk="urn:loc.gov:books" xmlns:isbn="urn:ISBN:0-395-36341-6">
  <bk:title>Cheaper by the Dozen</bk:title>
  <isbn:number>1568491379</isbn:number>
</bk:book>

you can arbitrarily define urn's on the fly for custom purposes?

like image 338
Thufir Avatar asked Nov 07 '10 02:11

Thufir


People also ask

What is urn in xmlns?

Uniform Resource Names (URNs) A Uniform Resource Name (URN) is a Uniform Resource Identifier (URI) that is assigned under the "urn" scheme and a particular URN namespace, with the intent that the URN will be either a persistent, location-independent resource identifier or in some cases an abstract designator that is ...

What is urn in XSD?

Each Magento module can contain XSD files for XML validation. Magento uses Uniform Resource Names (URNs) to reference XML schema declarations.

Why we use xmlns?

One of the primary motivations for defining an XML namespace is to avoid naming conflicts when using and re-using multiple vocabularies. XML Schema is used to create a vocabulary for an XML instance, and uses namespaces heavily.

How do I use xmlns in XML?

XML Namespaces - The xmlns Attribute When using prefixes in XML, a namespace for the prefix must be defined. The namespace can be defined by an xmlns attribute in the start tag of an element. The namespace declaration has the following syntax. xmlns:prefix="URI".


2 Answers

In short, yes. You can make 'em up as you like.

like image 99
Scott Baker Avatar answered Sep 21 '22 02:09

Scott Baker


I found this answer quite useful, and it led me to this article which seems to say that yes you can make them up as you like, and indeed you SHOULD, if you aren't going to place a document online for a given URL.

like image 31
Rodney Gitzel Avatar answered Sep 23 '22 02:09

Rodney Gitzel