Tutorial :How do you resolve a URN?



Question:

I have an XML schema file which references a urn based location. Is there some way to resolve this into a url, or some way to actually read the file it refers to.

<xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:tblDeclGrp.xsd:1.1"/>  


Solution:1

...maybe look at RFC3121 A URN Namespace for OASIS?

edit: I can never remember URIs and URNs, but my understanding is they're just namespaces, they don't actually have to correspond to some real location on the network where a file is stored. They just divide up control over portions of the namespace so urn:oasis is under control of OASIS. You're not supposed to invent any URIs / URNs that are within that section of the hierarchy unless you have control over it.

edit 2: A little google searching found a file in oasis-open.org called tblDeclGrp.xsd and some commentary on it and other schemas.


Solution:2

This question is not a good place for explanations about "URN resolution"... We can imagine a translation (by an automatic translator) from this oasis URN to a schemaLocation filename or a URL, but it is a little bit exotic application for URNs.

See the usual semantic and values for schemaLocation at http://www.w3.org/TR/xmlschema-1/#schema-repr


URN resolution

You can see real-life examples of URNs at Wikipedia and the complete semantic of the term "resolve a URN" at RFC-2169 and RFC-2483. According these RFCs what you need is a local software or a URL of a "URN resolver" software (a webservice) that do N2L: given a URN, return a URL.

Wide use URNs

In 2002 the URN resolution mechanism received more attention, and two new RTFs, RFC-3404 and RFC-3405, solved a latent problem of URNs,

If URN resolution is collapsed into generic URI resolution, URNs may suffer by the lack of adoption of URI resolution.

The solution is to allow for shortcutting for URN resolution. (...) generic URI resolution starts by inserting rules for known URI schemes into the 'uri.arpa.' registry. For the 'URN:' URI scheme, one of the rules found in 'uri.arpa.' would be for the 'urn' URI scheme. This rule would simply delegate to the 'urn.arpa.' zone for additional NAPTRs based on the URN namespace. Essentially, the URI Resolution Rewrite Rule for 'URN:' is the URN Resolution Application's First Well Known Rule.

Some resolution problems persist: URNs like urn:doi or urn:lex:br have a so used and stable resolution mechanism (at dx.doi.org and lexml.gov.br/urn respectively), but is not registered at IANA's assignments/urn-namespaces; a not used, not stable and not controlled URN like urn:oasis:names:tc:dita have urn:oasis registered at IANA.


Solution:3

The schemaLocation is in this case the location. If you have a file named exactly like this in the same directory it should be resolved. It is even include the urn: part so the complete string. It is just convienient to name the file after the schema namespace. Confusing at first I must admit.

Btw. the urn is not a location it is just an URI. The attribute of the xs:include schemaLocation that refers to a location but the attribute type is anyURI which includes urn schema


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »