Easy Tutorial
❮ El All El Documentation ❯

XSDText-Only


Text-only complex elements can contain text and attributes.


Text-Only Complex Elements

This type contains only simple content (text and attributes), so we need to add the simpleContent element to this content. When using simple content, we must define extensions or restrictions within the simpleContent element, like this:

Tip: Use the extension or restriction element to extend or restrict the basic simple type of the element. Here is an example of an XML element, "shoesize", which contains only text:

The following example declares a complex type whose content is defined as an integer value, and the "shoesize" element contains an attribute named "country":

We can also assign a name to the complexType element and have the type attribute of the "shoesize" element reference this name (using this method, multiple elements can reference the same complex type):

❮ El All El Documentation ❯