xsdata.utils.text module

xsdata.utils.text.prefix(string, sep=':')[source]

Return the first part of the string before the separator.

Parameters
  • string (str) –

  • sep (str) –

Return type

str

xsdata.utils.text.suffix(string, sep=':')[source]

Return the last part of the string after the separator.

Parameters
  • string (str) –

  • sep (str) –

Return type

str

xsdata.utils.text.split(string, sep=':')[source]

Separate the given string with the given separator and return a tuple of the prefix and suffix.

If the separator isn’t present in the string return None as prefix.

Parameters
  • string (str) –

  • sep (str) –

Return type

Tuple

xsdata.utils.text.capitalize(string)[source]

Capitalize the given string.

Parameters

string (str) –

Return type

str

xsdata.utils.text.pascal_case(string)[source]

Convert the given string to pascal case.

Parameters

string (str) –

Return type

str

xsdata.utils.text.snake_case(string)[source]

Convert the given string to snake case.

Parameters

string (str) –

Return type

str

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

Remove common prefixes and suffixes from a uri string.

Parameters

namespace (str) –

Return type

str

xsdata.utils.text.qname(tag_or_uri, tag=None)[source]

Create namespace qualified strings.

Parameters
Return type

str

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

Split namespace qualified strings.

Parameters

tag (str) –

Return type

Tuple