HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Complex element contains other elements and / or attributes.
Composite element refers to the XML element that contains other elements and / or attributes.
Note: The above elements can contain attributes!
Composite element, "product", is empty:
Composite element, "employee", contains only other elements:
Complex XML element, "food", containing only text:
Complex XML element, "description" contains elements and text:
Look at this complex XML element, "employee", contains only other elements:
In XML Schema, we have two ways to define complex elements:
1. Name the element directly to the "employee" element declaration, like this:
If you use the method described above, the only "employee" can use the complex type specified. Please note that its child elements, "firstname" and "lastname", are surrounded by the indicator <sequence> in. This means that the child elements must appear in the order they are declared. You'll XSD Indicators learn more about the indicators in this section.
2. "employee" element can use the type attribute, the role of this attribute is a reference to the name of the complex type to be used:
If you use the method described above, it can be used by a number of elements of the same complex type, like this:
You can also over an existing composite element to a composite element basis, and then add some elements, like this: