docx_plus.core.ns¶
Namespace constants and the qn() Clark-notation shortcut. Every other
module reaches for these when constructing or querying OOXML.
docx_plus.core.ns ¶
OOXML namespace URIs and Clark-notation helper.
All XML element construction in the library uses these constants and the
:func:qn helper, so that a single change here propagates everywhere.
NSMAP
module-attribute
¶
InvalidNamespaceError ¶
Bases: DocxPlusError, ValueError
Raised by :func:qn for a malformed name or unknown prefix.
Subclasses ValueError so existing except ValueError: clauses
still catch it; also subclasses :class:DocxPlusError per SPEC §9.7.
qn ¶
Convert "prefix:local" to Clark notation "{namespace}local".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Qualified name in |
required |
Returns:
| Type | Description |
|---|---|
str
|
The Clark-notation form |
Raises:
| Type | Description |
|---|---|
InvalidNamespaceError
|
If |
Example
qn("w:tag") '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tag'