def from_events(self, instance, ev_args, ctx):
        """
        Starting with the element to which the start event information in
        `ev_args` belongs, parse text data. If any children are encountered,
        :attr:`child_policy` is enforced (see
        :class:`UnknownChildPolicy`). Likewise, if the start event contains
        attributes, :attr:`attr_policy` is enforced
        (c.f. :class:`UnknownAttrPolicy`).

        The extracted text is passed through :attr:`type_` and
        :attr:`validator` and if it passes, stored in the attribute on the
        `instance` with which the property is associated.

        This method is suspendable.
        """

        # goal: take all text inside the child element and collect it as
        # attribute value

        attrs = ev_args[2]
        if attrs and self.attr_policy == UnknownAttrPolicy.FAIL:
            raise ValueError("unexpected attribute (at text only node)")
        parts = []
        while True:
            ev_type, *ev_args = yield
            if ev_type == "text":
                # collect ALL TEH TEXT!
                parts.append(ev_args[0])
            elif ev_type == "start":
                # ok, a child inside the child was found, we look at our policy
                # to see what to do
                yield from enforce_unknown_child_policy(
                    self.child_policy,
                    ev_args)
            elif ev_type == "end":
                # end of our element, return
                break

        joined = "".join(parts)
        try:
            parsed = self.type_.parse(joined)
        except (ValueError, TypeError):
            if self.erroneous_as_absent:
                return
            raise
        self._set_from_recv(instance, parsed)
def from_events ( self , instance , ev_args , ctx ) : attrs = ev_args [ 2 ] if attrs and self . attr_policy == UnknownAttrPolicy . FAIL : raise ValueError ( "unexpected attribute (at text only node)" ) parts = [ ] while True : ev_type , * ev_args = yield if ev_type == "text" : parts . append ( ev_args [ 0 ] ) elif ev_type == "start" : yield from enforce_unknown_child_policy ( self . child_policy , ev_args ) elif ev_type == "end" : break joined = "" . join ( parts ) try : parsed = self . type_ . parse ( joined ) except ( ValueError , TypeError ) : if self . erroneous_as_absent : return raise self . _set_from_recv ( instance , parsed )
Starting with the element to which the start event information in
        `ev_args` belongs, parse text data. If any children are encountered,
        :attr:`child_policy` is enforced (see
        :class:`UnknownChildPolicy`). Likewise, if the start event contains
        attributes, :attr:`attr_policy` is enforced
        (c.f. :class:`UnknownAttrPolicy`).

        The extracted text is passed through :attr:`type_` and
        :attr:`validator` and if it passes, stored in the attribute on the
        `instance` with which the property is associated.

        This method is suspendable.