You don't have to name every custom type : Anonymous Custom Types « XML Schema « XML Tutorial






If you're just going to use a type once, you can omit the cross reference between the element and the type.
The only difference between an anonymous type and a named type is that a named type can be used more than once. 
whereas the anonymous type can only be used for the element in which it is contained.

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.java2s.com" xmlns="http://www.java2s.com"
  elementFormDefault="qualified">

  <xsd:element name="zipcode">

    <xsd:simpleType>

      <xsd:restriction base="xsd:string">

        <xsd:pattern value="\d{5}(-\d{4})?" />

      </xsd:restriction>

    </xsd:simpleType>

  </xsd:element>

</xsd:schema>








3.83.Anonymous Custom Types
3.83.1.You don't have to name every custom type
3.83.2.Elements with Anonymous Complex Types