# ElementNode

class xsdata.formats.dataclass.parsers.nodes.ElementNode(meta, attrs, ns_map, config, context, position, mixed=False, derived_factory=None, xsi_type=None, xsi_nil=None)

  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_factory (`Optional`[`Type`, `None`]) – Derived element factory

    - xsi_type (`Optional`[`str`, `None`]) – The xml type substitution

    - xsi_nil (`Optional`[`bool`, `None`]) – The xml type substitution

  bind(qname, text, tail, objects)

    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`, `None`]) – Text content

      - tail (`Optional`[`str`, `None`]) – Tail content

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

    Return type

      `bool`

  bind_attrs(params)

    Parse the given element’s attributes and any text content and return a dictionary of field names and values based on the given class metadata.

  bind_objects(params, objects)

    Return a dictionary of qualified object names and their values for the given queue item.

  classmethod bind_var(params, var, value)

    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.

    Return type

      `bool`

    Returns

      Whether the binding process was successful or not.

  bind_wild_var(params, var, qname, value)

    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.

    Return type

      `bool`

  bind_mixed_objects(params, var, objects)

    Return a dictionary of qualified object names and their values for the given mixed content xml var.

  prepare_generic_value(qname, value)

    Prepare parsed value before binding to a wildcard field.

    Return type

      `Any`

  bind_text(params, text)

    Add the given element’s text content if any to the params dictionary with the text var name as key.

    Return if any data was bound.

    Return type

      `bool`

  bind_wild_text(params, var, txt, tail)

    Extract the text and tail content and bind it accordingly in the params dictionary. Return if any data was bound.

    - 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.

    Return type

      `bool`

  child(qname, attrs, ns_map, position)

    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`