XSD Empty Elements
An empty complex element cannot contain content, only attributes.
Complex empty element:
An empty XML element:
The "product" element above has no content at all. To define a type with no content, we must declare a type that can only contain elements in its content, but in fact we will not declare any elements, like this:
In the example above, we defined a complex type with complex content. The complexContent element signals that we intend to restrict or extend the content model of a complex type, while the integer restriction declares an attribute without introducing any element content.
However, this "product" element can also be declared more compactly:
Or you can give a complexType element a name, then set a type attribute on the "product" element that refers to this complexType name (by using this method, several elements can refer to the same complex type):