xsdata.parser module¶
-
class
xsdata.parser.
Force
[source]¶ Bases:
enum.Enum
An enumeration.
-
NO
= 0¶
-
MIN_ONLY
= 1¶
-
MAX_ONLY
= 2¶
-
BOTH
= 3¶
-
-
class
xsdata.parser.
SchemaParser
(name_generator=<function camel_case>, cache=<factory>, index=<factory>, target_namespace=None, default_attributes=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
-
element_form
: Optional[xsdata.models.enums.FormType] = None¶
-
attribute_form
: Optional[xsdata.models.enums.FormType] = None¶
-
target_namespace
: Optional[str] = None¶
-
default_attributes
: Optional[str] = None¶
-
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]¶ Set schema namespaces and default form for elements and attributes.
-
set_schema_forms
(obj)[source]¶ Set the default form type for elements and attributes.
Global elements and attributes are by default qualified.
-
set_schema_namespaces
(obj, element)[source]¶ Set the given schema’s target namespace and add the default namespaces if the are missing xsi, xlink, xml, xs.
-
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.
-
end_complex_type
(obj, element)[source]¶ Prepend an attribute group reference when default attributes apply.
-
classmethod
end_choice
(obj, element)[source]¶ Elements inside a choice are by definition optional, reset their min occurs counter.
-
classmethod
end_all
(obj, element)[source]¶ Elements inside an all element can by definition appear at most once, reset their max occur counter.
-