Skip to content

Commit 6baf513

Browse files
committed
Add docs on how to override default namespace map
1 parent 2ddaaf9 commit 6baf513

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ For detached signatures, the code above will use the ``Id`` or ``ID`` attribute
134134

135135
See the `API documentation <https://xml-security.github.io/signxml/#id5>`_ for more.
136136

137+
138+
Configuring namespace prefixes
139+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140+
Some applications require a particular namespace prefix configuration - for example, a number of applications assume
141+
that the ``http://www.w3.org/2000/09/xmldsig#`` namespace is set as the default, unprefixed namespace instead of using
142+
the customary ``ds:`` prefix. To configure the namespace prefix map when generating a signature, set the
143+
``XMLSigner.namespaces`` attribute:
144+
145+
.. code-block:: python
146+
147+
signer = signxml.XMLSigner(...)
148+
signer.namespaces = {None: signxml.namespaces.ds}
149+
150+
137151
XML parsing security and compatibility with ``xml.etree.ElementTree``
138152
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139153
SignXML uses the `lxml <https://github.com/lxml/lxml>`_ ElementTree library, not the

0 commit comments

Comments
 (0)