xmlsec.tree#

Common XML utility functions

xmlsec.tree.add_ids(node, ids) None#

Registers ids as ids used below node. ids is a sequence of attribute names used as XML ids in the subtree rooted at node. A call to add_ids() may be necessary to make known which attributes contain XML ids. This is the case, if a transform references an id via XPointer or a self document uri and the id inkey_data_formation is not available by other means (e.g. an associated DTD or XML schema).

Parameters
xmlsec.tree.find_child(parent, name, namespace)#

Searches a direct child of the parent node having given name and namespace href.

Parameters
  • parent (lxml.etree._Element) – the pointer to XML node

  • name (str) – the name

  • namespace (str) – the namespace href (optional)

Returns

the pointer to the found node or None if node is not found

Return type

lxml.etree._Element or None

xmlsec.tree.find_node(node, name, namespace)#

Searches all children of the given node having given name and namespace href.

Parameters
  • node (lxml.etree._Element) – the pointer to XML node

  • name (str) – the name

  • namespace (str) – the namespace href (optional)

Returns

the pointer to the found node or None if node is not found

Return type

lxml.etree._Element or None

xmlsec.tree.find_parent(node, name, namespace)#

Searches the ancestors axis of the node having given name and namespace href.

Parameters
  • node (lxml.etree._Element) – the pointer to XML node

  • name (str) – the name

  • namespace (str) – the namespace href (optional)

Returns

the pointer to the found node or None if node is not found

Return type

lxml.etree._Element or None

Table of contents