Returns an overall namespace map for DetaElement, resolving prefix redefinitions. :param namespaces: builds the namespace map starting over the dictionary provided. :param root_only: if `True` processes only the namespaces declared in the data \ element, otherwise p
(self, namespaces: Optional[NsmapType] = None,
root_only: bool = True)
| 228 | yield child |
| 229 | |
| 230 | def get_namespaces(self, namespaces: Optional[NsmapType] = None, |
| 231 | root_only: bool = True) -> dict[str, str]: |
| 232 | """ |
| 233 | Returns an overall namespace map for DetaElement, resolving prefix redefinitions. |
| 234 | |
| 235 | :param namespaces: builds the namespace map starting over the dictionary provided. |
| 236 | :param root_only: if `True` processes only the namespaces declared in the data \ |
| 237 | element, otherwise precesses also other namespaces declared in its descendants. |
| 238 | """ |
| 239 | if namespaces is None: |
| 240 | namespaces = {} |
| 241 | else: |
| 242 | namespaces = {k: v for k, v in namespaces.items()} |
| 243 | |
| 244 | if root_only: |
| 245 | update_namespaces(namespaces, self.nsmap.items(), root_declarations=True) |
| 246 | else: |
| 247 | nsmap = None |
| 248 | for elem in self.iter(): |
| 249 | if nsmap is not elem.nsmap: |
| 250 | nsmap = elem.nsmap |
| 251 | update_namespaces(namespaces, nsmap.items(), elem is self) |
| 252 | |
| 253 | return namespaces |
| 254 | |
| 255 | def validate(self, use_defaults: bool = True, |
| 256 | namespaces: Optional[NsmapType] = None, |
no test coverage detected