OOXML namespaces

benker.parsers.ooxml.namespaces.NS = {'w': 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'}

Namespace map used for xpath evaluation in Office Open XML documents

benker.parsers.ooxml.namespaces.ns_name(ns, name)
benker.parsers.ooxml.namespaces.value_of(element, xpath, *, namespaces={'w': 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'}, default=None)

Take the first value of a xpath evaluation.

  • element (etree._Element) – Root element used to evaluate the xpath expression.
  • xpath (str) – xpath expression. This expression will be evaluated using the namespaces namespaces.
  • namespaces (dict[str, str]) – Namespace map to use for the xpath evaluation.
  • default – default value used if the xpath evaluation returns no result.

the first result or the default value.