Stands for "qualified name". This utility function converts a familiar namespace-prefixed tag name like "w:p" into a Clark-notation qualified tag name for lxml. For example, `qn("w:p")` returns "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p".
(tag: str)
| 98 | |
| 99 | |
| 100 | def qn(tag: str) -> str: |
| 101 | """Stands for "qualified name". |
| 102 | |
| 103 | This utility function converts a familiar namespace-prefixed tag name like "w:p" |
| 104 | into a Clark-notation qualified tag name for lxml. For example, `qn("w:p")` returns |
| 105 | "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p". |
| 106 | """ |
| 107 | prefix, tagroot = tag.split(":") |
| 108 | uri = nsmap[prefix] |
| 109 | return "{%s}%s" % (uri, tagroot) |
no outgoing calls