With the Russian Doll Design, the schema mirrors the structure of the instance document
File: Data.xml
<?xml version = "1.0" ?>
<Customer xmlns = "http://www.java2s.com/Customers"
customerID = "2442"
clubCardMember = "true" >
<FirstName>first</FirstName>
<MiddleInitial>middle</MiddleInitial>
<LastName>last</LastName>
</Customer>
File: Schema.xsd
<?xml version = "1.0" ?>
<schema xmlns = "http://www.w3.org/2001/XMLSchema"
targetNamespace = "http://www.java2s.com/Customers"
xmlns:cust = "http://www.java2s.com/Customers"
elementFormDefault = "qualified"
attributeFormDefault = "unqualified">
<element name = "Customer">
<complexType>
<sequence>
<element name = "FirstName" type = "string" />
<element name = "MiddleInitial" type = "string" minOccurs = "0" maxOccurs = "1" />
<element name = "LastName" type = "string" />
</sequence>
<attribute name = "customerID" use = "required" type = "integer" />
<attribute name = "clubCardMember" type = "boolean" />
</complexType>
</element>
</schema>
Related examples in the same category