Easy Tutorial
❮ El Complextype Schema Complex Mixed ❯

XSD Empty Element


An empty complex element cannot contain content, only attributes.


Empty Complex Element:

An empty XML element:

The "product" element above has no content at all. To define a type without content, we must declare a type that can only contain elements within its content, but in reality, we do not declare any elements. For example:

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, and the integer restriction declares an attribute but does not introduce any element content.

However, this "product" element can also be declared more compactly:

Alternatively, you can give a complexType element a name, then set a type attribute for the "product" element and reference this complexType name (using this method, multiple elements can reference the same complex type):

❮ El Complextype Schema Complex Mixed ❯