xmlsec.tree
#
Common XML utility functions
- xmlsec.tree.add_ids(node, ids) None #
Registers
ids
as ids used belownode
.ids
is a sequence of attribute names used as XML ids in the subtree rooted atnode
. A call toadd_ids()
may be necessary to make known which attributes contain XML ids. This is the case, if a transform references an id viaXPointer
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
node (
lxml.etree._Element
) – the pointer to XML nodeids (
list
of strings) – the list of ID attributes.
- xmlsec.tree.find_child(parent, name, namespace)#
Searches a direct child of the
parent
node having givenname
andnamespace
href.- Parameters
parent (
lxml.etree._Element
) – the pointer to XML nodename (
str
) – the namenamespace (
str
) – the namespace href (optional)
- Returns
the pointer to the found node or
None
if node is not found- Return type
- xmlsec.tree.find_node(node, name, namespace)#
Searches all children of the given
node
having givenname
andnamespace
href.- Parameters
node (
lxml.etree._Element
) – the pointer to XML nodename (
str
) – the namenamespace (
str
) – the namespace href (optional)
- Returns
the pointer to the found node or
None
if node is not found- Return type
- xmlsec.tree.find_parent(node, name, namespace)#
Searches the ancestors axis of the
node
having givenname
andnamespace
href.- Parameters
node (
lxml.etree._Element
) – the pointer to XML nodename (
str
) – the namenamespace (
str
) – the namespace href (optional)
- Returns
the pointer to the found node or
None
if node is not found- Return type