@classmethod<EOL><INDENT>def from_xml(cls, element):<DEDENT>
if element.tag != ITEM_TAG:<EOL><INDENT>raise ValueError("<STR_LIT>".format(element))<EOL><DEDENT>try:<EOL><INDENT>jid = JID(element.get("<STR_LIT>"))<EOL><DEDENT>except ValueError:<EOL><INDENT>raise BadRequestProtocolError("<STR_LIT>")<EOL><DEDENT>subscription = element.get("<STR_LIT>")<EOL>ask = element.get("<STR_LIT>")<EOL>name = element.get("<STR_LIT:name>")<EOL>duplicate_group = False<EOL>groups = set()<EOL>for child in element:<EOL><INDENT>if child.tag != GROUP_TAG:<EOL><INDENT>continue<EOL><DEDENT>group = child.text<EOL>if group is None:<EOL><INDENT>group = "<STR_LIT>"<EOL><DEDENT>if group in groups:<EOL><INDENT>duplicate_group = True<EOL><DEDENT>else:<EOL><INDENT>groups.add(group)<EOL><DEDENT><DEDENT>approved = element.get("<STR_LIT>")<EOL>if approved == "<STR_LIT:true>":<EOL><INDENT>approved = True<EOL><DEDENT>elif approved in ("<STR_LIT:false>", None):<EOL><INDENT>approved = False<EOL><DEDENT>else:<EOL><INDENT>logger.debug("<STR_LIT>"<EOL>"<STR_LIT>".format(approved))<EOL>approved = False<EOL><DEDENT>result = cls(jid, name, groups, subscription, ask, approved)<EOL>result._duplicate_group = duplicate_group<EOL>return result<EOL>
Make a RosterItem from an XML element.

        :Parameters:
            - `element`: the XML element
        :Types:
            - `element`: :etree:`ElementTree.Element`

        :return: a freshly created roster item
        :returntype: `cls`