XSD Element
The following example is a snippet from an XML schema named "family.xsd". It shows us a declaration for the "person" element. By using the
Now, we want to extend the "person" element with a "gender" attribute. We can do this in this case even if the author of this schema never declared any "gender" attribute.
Look at this schema file, named "attribute.xsd":
targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementFormDefault="qualified">
The following XML (named "Myfamily.xml") uses components from different schemas, "family.xsd" and "attribute.xsd":
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:SchemaLocation="http://www.microsoft.com family.xsd http://www.w3schools.com attribute.xsd"> The XML file above is valid because the schema "family.xsd" allows us to add attributes to the "person" element.