xsdata.utils.namespaces module

xsdata.utils.namespaces.load_prefix(uri, ns_map)[source]

Get or create a prefix for the given uri in the prefix-URI namespace mapping.

Parameters
Return type

Optional[str]

xsdata.utils.namespaces.generate_prefix(uri, ns_map)[source]

Generate and add a prefix for the given uri in the prefix-URI namespace mapping.

Parameters
Return type

str

xsdata.utils.namespaces.prefix_exists(uri, ns_map)[source]

Check if the uri exists in the prefix-URI namespace mapping.

Parameters
Return type

bool

xsdata.utils.namespaces.clean_prefixes(ns_map)[source]

Remove default namespace if it’s also assigned to a prefix.

Parameters

ns_map (Dict) –

Return type

Dict

xsdata.utils.namespaces.clean_uri(namespace)[source]

Remove common prefixes and suffixes from a uri string.

Parameters

namespace (str) –

Return type

str

xsdata.utils.namespaces.build_qname(tag_or_uri, tag=None)[source]

Create namespace qualified strings.

Parameters
Return type

str

xsdata.utils.namespaces.split_qname(tag)[source]

Split namespace qualified strings.

Parameters

tag (str) –

Return type

Tuple