May 28, 2021 XML Schema
This section introduces you to the use of XML Schema any elements that can be used to extend XML documentation.
The element gives us the ability to expand the XML documentation through elements that are not specified by schema!
The element
The element gives us the ability to expand the XML documentation through elements that are not specified by schema!
The following example is a reference to a fragment from XML schema named "family.xsd". I t shows a declaration for the "person" element. By using the element, we can extend the content of the "person" by any element (after the element:
Tip:
If you add a complex type to the list of complex types, you can extend the original complex type by adding a "0" or "0" to any minOccurs.
Now we want to use the "children" element to extend the "person" element. In this case, we can do so, even if the author of the schema above does not declare any "children" elements.
Look at this schema file, named "children.xsd":
The following XML file (named "Myfamily .xml") uses ingredients from two different schemas, "family.xsd" and "children.xsd":
This XML file above is valid because schema "family.xsd" allows us to extend the "person" element by selecting elements after the "lastname" element.
Both slt;any and anyAttribute are available to produce scalable documents! They give the document the ability to contain additional elements that have not been declared in the main XML schema.
In the next section, we'll cover the anyAttribute element.