xsdata.formats.dataclass.parsers.utils module¶
-
class
xsdata.formats.dataclass.parsers.utils.
ParserUtils
[source]¶ Bases:
object
-
classmethod
parse_xsi_type
(element)[source]¶ Parse the elements xsi:type attribute if present.
- Parameters
element (
Element
) –- Return type
Optional
[QName
]
-
classmethod
parse_value
(types, value, default=None, ns_map=None, tokens=False)[source]¶ Convert xml string values to s python primitive type.
-
classmethod
bind_element_children
(params, meta, position, objects)[source]¶ Return a dictionary of qualified object names and their values for the given queue item.
-
classmethod
bind_element_param
(params, var, value)[source]¶ Add the given value to the params dictionary with the var name as key.
Wrap the value to a list if var is a list. If the var name already exists it means we have a name conflict and the parser needs to lookup for any available wildcard fields.
-
classmethod
bind_element_wildcard_param
(params, var, qname, value)[source]¶ Add the given value to the params dictionary with the wildcard var name as key.
If the key is already present wrap the previous value into a generic AnyElement instance. If the previous value is already a generic instance add the current value as a child object.
-
classmethod
bind_element_wild_text
(params, meta, element)[source]¶ Extract the text and tail content and bind it accordingly in the params dictionary.
var is a list prepend the text and append the tail.
var is present in the params assign the text and tail to the generic object.
Otherwise bind the given element to a new generic object.
-
classmethod
element_text_and_tail
(element)[source]¶ Extract the text and tail content if any and return them both.
- Parameters
element (
Element
) –- Return type
-
classmethod
parse_any_element
(element, qname=True)[source]¶ Bind the given element content to a new generic object.
- Parameters
element (
Element
) –qname (
bool
) –
- Return type
-
classmethod
parse_any_attributes
(element)[source]¶ Extract the given element’s attributes into the dictionary with keys the fully qualified attribute names.
-
classmethod
bind_element_text
(params, metadata, element)[source]¶ Add the given element’s text content if any to the params dictionary with the text var name as key.
-
classmethod