UnionNode¶
- class xsdata.formats.dataclass.parsers.nodes.UnionNode(var, attrs, ns_map, position, config, context)[source]¶
XmlNode for fields with multiple possible types where at least one of them is a dataclass.
The node will record all child events and in the end will replay them and try to build all possible objects and sort them by score before deciding the winner.
- Parameters
var (
XmlVar
) – Class field xml var instanceattrs (
Dict
) – Key-value attribute mappingns_map (
Dict
) – Namespace prefix-URI mapposition (
int
) – The node position of objects cacheconfig (
ParserConfig
) – Parser configurationcontext (
XmlContext
) – Model context provider
- child(qname, attrs, ns_map, position)[source]¶
Initialize the next child node to be queued, when a new xml element starts.
This entry point is responsible to create the next node type with all the necessary information on how to bind the incoming input data.
- bind(qname, text, tail, objects)[source]¶
Build the object tree for the ending element and return whether the result was successful or not.
This entry point is called when an xml element ends and is responsible to parse the current element attributes/text, bind any children objects and initialize new object.