def __from_xml(self, xmlnode):
self.fields = []<EOL>self.reported_fields = []<EOL>self.items = []<EOL>self.title = None<EOL>self.instructions = None<EOL>if (xmlnode.type != "<STR_LIT>" or xmlnode.name != "<STR_LIT:x>"<EOL>or xmlnode.ns().content != DATAFORM_NS):<EOL><INDENT>raise ValueError("<STR_LIT>" + xmlnode.serialize())<EOL><DEDENT>self.type = xmlnode.prop("<STR_LIT:type>")<EOL>if not self.type in self.allowed_types:<EOL><INDENT>raise BadRequestProtocolError("<STR_LIT>" % (self.type,))<EOL><DEDENT>child = xmlnode.children<EOL>while child:<EOL><INDENT>if child.type != "<STR_LIT>" or child.ns().content != DATAFORM_NS:<EOL><INDENT>pass<EOL><DEDENT>elif child.name == "<STR_LIT:title>":<EOL><INDENT>self.title = from_utf8(child.getContent())<EOL><DEDENT>elif child.name == "<STR_LIT>":<EOL><INDENT>self.instructions = from_utf8(child.getContent())<EOL><DEDENT>elif child.name == "<STR_LIT>":<EOL><INDENT>self.fields.append(Field._new_from_xml(child))<EOL><DEDENT>elif child.name == "<STR_LIT>":<EOL><INDENT>self.items.append(Item._new_from_xml(child))<EOL><DEDENT>elif child.name == "<STR_LIT>":<EOL><INDENT>self.__get_reported(child)<EOL><DEDENT>child = child.next<EOL><DEDENT>
Initialize a `Form` object from an XML element.

        :Parameters:
            - `xmlnode`: the XML element.
        :Types:
            - `xmlnode`: `libxml2.xmlNode`