ElementNode

class xsdata.formats.dataclass.parsers.nodes.ElementNode(meta, attrs, ns_map, config, context, position, mixed=False, derived=False, xsi_type=None)[source]

XmlNode for complex elements and dataclasses.

Parameters
  • meta (XmlMeta) – Model xml metadata

  • attrs (Dict) – Key-value attribute mapping

  • ns_map (Dict) – Namespace prefix-URI map

  • config (ParserConfig) – Parser configuration

  • context (XmlContext) – Model context provider

  • position (int) – The node position of objects cache

  • mixed (bool) – The node supports mixed content

  • derived (bool) – The xml element is derived from a base type

  • xsi_type (Optional[str]) – The xml type substitution

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.

Parameters
  • qname (str) – Qualified name

  • text (Optional[str]) – Text content

  • tail (Optional[str]) – Tail content

  • objects (List) – The list of intermediate parsed objects, eg [(qname, object)]

Return type

bool

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.

Parameters
  • qname (str) – Qualified name

  • attrs (Dict) – Attribute key-value map

  • ns_map (Dict) – Namespace prefix-URI map

  • position (int) – The current objects position, to mark future objects as children

Return type

XmlNode