xmlelement takes an element name for identifier, an optional collection of attributes for the element, and arguments that make up the element's content. It returns an instance of type XMLType. xmlelement is similar to sys_xmlgen except that xmlelement can include attributes in the XML returned, but it does not accept formatting using the XMLFormat object.
The xmlelement function is typically nested to produce an XML document with a nested structure, as in the example in the following section.
You must specify a value for identifier, which Oracle uses as the enclosing tag. The identifier does not have to be a column name or column reference. It cannot be an expression or null.
In the XML_attributes_clause, if the value_expr is null, then no attribute is created for that value expression. The type of value_expr cannot be an object type or collection.
The objects that make up the element content follow the XMLATTRIBUTES keyword.