Skip to content

namespace

Canonical path: o6.ns.namespace

namespace

namespace(
    shortname, uri, version="1.0", publicationDate=""
)

Register a namespace in the global namespace table.

Called at the top of a namespace module, before the decorated classes below it, so that the declarations know which namespace they belong to:

o6.ns.namespace("plant", uri="http://example.org/Plant/", version="1.0")

Unlike [o6.ns.register][] this returns nothing, and when the calling module is itself the namespace module it adopts that module rather than creating a second one.

Parameters:

Name Type Description Default
shortname str

Short name to register the namespace under, and the attribute it becomes on o6.ns.

required
uri str

Namespace URI published by this model.

required
version str

Model version string.

'1.0'
publicationDate str

Publication date declared by the model.

''

Raises:

Type Description
ValueError

The shortname is already registered for a different URI, scope, or version.

See Writing a Nodeset in Python.