DOKK / manpages / debian 11 / lua-uri / lua-uri-urn.3.en
LUA-URI-URN(3) Lua uri.urn module LUA-URI-URN(3)

lua-uri-urn - URN support for Lua URI library

The class "uri.urn" is used for URNs, that is, URIs with the "urn" scheme. It inherits from the uri class.

Any URN containing an authority part or query part is considered to be invalid, as is one which does not have a valid NID. URNs must be of the form "urn:nid:nss", where the NSS part has a syntax specific to the NID. The scheme and NID part are both normalized to lowercase. Some NIDs have subclasses which enforce further syntax constraints, do NID-specific normalization, or provide additional methods.

All the methods defined in lua-uri(3) are supported. The "userinfo", "host", "port", and "query" methods will always return nil, and will throw an exception when passed anything other than nil. The "path" method will throw an exception if given a new path which is nil or not valid for the "urn" scheme.

The following additional methods are supported:

Get or set the NID (Namespace Identifier) of the URN (the part of the path before the first colon). If a new value is supplied then the URI's path will be changed to have the new NID but with the same NSS value.

An exception will be thrown if the new NID is invalid, or if the existing NSS value is invalid in the context of the new NID. Note that the value 'urn' is an invalid NID.

This can cause the class of the URI object to change, if a different class is appropriate for the new NID.

Get or set the NSS (Namespace Specific String) part of the URN (the part of the path after the first colon). If a new value is supplied then the URI's path will be changed to use the new NSS, but the NID will be unchanged.

This will throw an exception if the new value is invalid for the current NID.

The following subclasses are used for URNs with certain NIDs. URNs with other NIDs just use the generic "uri.urn" class.

This class is based on "RFC 2141".

2012-00-00 1.1