xsdata.formats.mixins module

class xsdata.formats.mixins.AbstractSerializer[source]

Bases: abc.ABC

abstract render(obj)[source]
Return type

object

class xsdata.formats.mixins.AbstractParser[source]

Bases: abc.ABC

from_path(path, clazz)[source]

Parse the input file path and return the resulting object tree.

Return type

~T

from_string(source, clazz)[source]

Parse the input string and return the resulting object tree.

Return type

~T

from_bytes(source, clazz)[source]

Parse the input bytes array return the resulting object tree.

Return type

~T

abstract parse(source, clazz)[source]

Parse the input stream and return the resulting object tree.

Return type

~T

classmethod parse_value(tp, value)[source]

Convert xml string values to s python primitive type.

Return type

Any

class xsdata.formats.mixins.AbstractXmlParser[source]

Bases: xsdata.formats.mixins.AbstractParser

parse(source, clazz)[source]

Parse the XML input stream and return the resulting object tree.

Return type

~T

parse_context(context, clazz)[source]

Dispatch elements to handlers as they arrive and are fully parsed.

Raises

ValueError – When the requested type doesn’t match the result object

Return type

~T

abstract start_node(element)[source]

Prepare to create an object tree from the given starting element.

abstract end_node(element)[source]

Create an object tree from the given fully parsed element.

Return type

Optional[Type]