XSD for Dynamic Memory

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  version="1.0" elementFormDefault="qualified">
  <xs:element name="dynamicMemory">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" name="memoryName" maxOccurs="1">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:minLength value="1" />
              <xs:maxLength value="50" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="1" name="memoryId" type="xs:int" />
        <xs:element minOccurs="1" name="fileId">
          <xs:simpleType>
            <xs:restriction base="xs:int">
              <xs:minInclusive value="1" />
              <xs:maxInclusive value="65471" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="0" maxOccurs="1" name="size" type="xs:int" />
        <xs:element name="lifeCycleStage" maxOccurs="1" minOccurs="1">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="DRAFT" />
              <xs:enumeration value="DEPLOYED" />
              <xs:enumeration value="OBSOLETE" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="0" name="memoryDescription">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:minLength value="0" />
              <xs:maxLength value="510" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="0" name="refId1" maxOccurs="1">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:minLength value="0" />
              <xs:maxLength value="250" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="0" name="refId2" maxOccurs="1">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:minLength value="0" />
              <xs:maxLength value="250" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element name="action" maxOccurs="1" minOccurs="1">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="NONE" />
              <xs:enumeration value="SET" />
              <xs:enumeration value="CANCEL" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element maxOccurs="unbounded" minOccurs="0" name="memories" type="MemoriesType" />
        <xs:element name="memoryType">
          <xs:simpleType>
            <xs:restriction base="xs:int">
              <xs:enumeration value="1" />
              <xs:enumeration value="2" />
              <xs:enumeration value="3" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="MemoriesType">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="memorySegment" type="MemorySegmentType" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="MemorySegmentType">
    <xs:sequence>
      <xs:element minOccurs="0" name="name">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:minLength value="0" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element minOccurs="0" name="description">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:minLength value="0" />
            <xs:maxLength value="250" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element minOccurs="1" name="offset">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:minLength value="1" />
            <xs:maxLength value="10" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element minOccurs="0" name="size" type="xs:int" />
      <xs:element minOccurs="0" name="content" type="xs:string" />
      <xs:element minOccurs="0" name="color">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:minLength value="1" />
            <xs:maxLength value="10" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element minOccurs="1" name="saot" type="xs:boolean" />
    </xs:sequence>
  </xs:complexType>
</xs:schema>