def complete_xml_element(self, xmlnode, doc):
if self.type is not None and self.type not in self.allowed_types:<EOL><INDENT>raise ValueError("<STR_LIT>" % (self.type,))<EOL><DEDENT>if self.type is not None:<EOL><INDENT>xmlnode.setProp("<STR_LIT:type>", self.type)<EOL><DEDENT>if not self.label is None:<EOL><INDENT>xmlnode.setProp("<STR_LIT:label>", to_utf8(self.label))<EOL><DEDENT>if not self.name is None:<EOL><INDENT>xmlnode.setProp("<STR_LIT>", to_utf8(self.name))<EOL><DEDENT>if self.values:<EOL><INDENT>if self.type and len(self.values) > <NUM_LIT:1> and not self.type.endswith(u"<STR_LIT>"):<EOL><INDENT>raise ValueError("<STR_LIT>" % (self.type,))<EOL><DEDENT>for value in self.values:<EOL><INDENT>xmlnode.newTextChild(xmlnode.ns(), "<STR_LIT:value>", to_utf8(value))<EOL><DEDENT><DEDENT>for option in self.options:<EOL><INDENT>option.as_xml(xmlnode, doc)<EOL><DEDENT>if self.required:<EOL><INDENT>xmlnode.newChild(xmlnode.ns(), "<STR_LIT>", None)<EOL><DEDENT>if self.desc:<EOL><INDENT>xmlnode.newTextChild(xmlnode.ns(), "<STR_LIT>", to_utf8(self.desc))<EOL><DEDENT>return xmlnode<EOL>
Complete the XML node with `self` content.

        :Parameters:
            - `xmlnode`: XML node with the element being built. It has already
              right name and namespace, but no attributes or content.
            - `doc`: document to which the element belongs.
        :Types:
            - `xmlnode`: `libxml2.xmlNode`
            - `doc`: `libxml2.xmlDoc`