xsdata.parser module

class xsdata.parser.SchemaParser(name_generator=<function camel_case>, cache=<factory>, index=<factory>, target_namespace=None)[source]

Bases: xsdata.formats.dataclass.parsers.XmlParser

name_generator()

A simple parser to convert an xsd schema to an easy to handle data structure based on dataclasses.

The parser is a dummy as possible but it will try to normalize certain things like apply parent properties to children.

Return type

str

element_form: Optional[xsdata.models.enums.FormType] = None
attribute_form: Optional[xsdata.models.enums.FormType] = None
target_namespace: Optional[str] = None
from_xsd_string(source)[source]
Return type

Schema

from_xsd_path(path)[source]
Return type

Schema

end_node(element)[source]

Override parent method to skip empty elements and to set the object index.

Return type

Optional[~T]

start_schema(element, item)[source]

Collect the schema’s default form for attributes and elements for later usage.

end_schema(obj, element)[source]

Collect the schema’s default form for attributes and elements for later usage.

end_element(obj, element)[source]

Assign the schema’s default form for elements if the given element form is None.

end_attribute(obj, element)[source]

Assign the schema’s default form for attributes if the given attribute form is None.

static end_choice(obj, element)[source]

Elements inside a choice are by definition optional, reset their min occurs counter.

static end_all(obj, element)[source]

Elements inside an all element can by definition appear at most once, reset their max occur counter.

static end_sequence(obj, element)[source]

Elements inside a sequence inherit min|max occur counter if it is not set.

classmethod parse_value(tp, value)[source]

Convert xml string values to s python primitive type.

Return type

Any