<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="targetGeometry">
    <xs:complexType>
      <xs:group minOccurs="0" maxOccurs="unbounded" ref="geometry-element"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="geometryGroup" type="geometryGroup-content"/>
  <xs:complexType name="geometryGroup-content">
    <xs:group maxOccurs="unbounded" ref="geometry-element"/>
    <xs:attribute name="name" use="required" type="xs:token"/>
  </xs:complexType>
  <xs:group name="geometry-element">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="component"/>
        <xs:element ref="geometryGroup"/>
      </xs:choice>
    </xs:sequence>
  </xs:group>
  <xs:element name="component">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" ref="description"/>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element ref="cylinder"/>
          <xs:element ref="ellipsoid"/>
          <xs:element ref="faceSet"/>
          <xs:element ref="tube"/>
          <xs:element ref="sphere"/>
          <xs:element ref="box"/>
          <xs:element ref="extrusion"/>
        </xs:choice>
      </xs:sequence>
      <xs:attributeGroup ref="name-attribute"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="translation">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="three-doubles-list">
          <xs:attributeGroup ref="dimension-attribute"/>
          <xs:attributeGroup ref="Length-attribute"/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="rotation">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="three-doubles-list">
          <xs:attributeGroup ref="dimension-attribute"/>
          <xs:attributeGroup ref="Length-attribute"/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="about">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="three-doubles-list">
          <xs:attributeGroup ref="dimension-attribute"/>
          <xs:attributeGroup ref="Length-attribute"/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="length">
    <xs:complexType>
      <xs:simpleContent>
        <xs:restriction base="xs:anyType">
          <xs:simpleType>
            <xs:restriction base="xs:double">
              <xs:minExclusive value="0"/>
            </xs:restriction>
          </xs:simpleType>
          <xs:attributeGroup ref="dimension-attribute"/>
          <xs:attributeGroup ref="Length-attribute"/>
        </xs:restriction>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="radius">
    <xs:complexType>
      <xs:simpleContent>
        <xs:restriction base="xs:anyType">
          <xs:simpleType>
            <xs:restriction base="xs:double">
              <xs:minExclusive value="0"/>
            </xs:restriction>
          </xs:simpleType>
          <xs:attributeGroup ref="dimension-attribute"/>
          <xs:attributeGroup ref="Length-attribute"/>
        </xs:restriction>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="base1">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="three-doubles-list">
          <xs:attributeGroup ref="dimension-attribute"/>
          <xs:attributeGroup ref="Length-attribute"/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="base2">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="three-doubles-list">
          <xs:attributeGroup ref="dimension-attribute"/>
          <xs:attributeGroup ref="Length-attribute"/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="transform">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" ref="translation"/>
        <xs:element minOccurs="0" ref="rotation"/>
        <xs:element minOccurs="0" ref="about"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="cyl-transform">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="translation"/>
        <xs:element minOccurs="0" ref="rotation"/>
        <xs:element minOccurs="0" ref="about"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="cylinder">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="radius"/>
        <xs:choice>
          <xs:choice>
            <xs:element ref="length"/>
            <xs:element ref="cyl-transform"/>
          </xs:choice>
          <xs:choice>
            <xs:element ref="base1"/>
            <xs:element ref="base2"/>
            <xs:element minOccurs="0" maxOccurs="unbounded" ref="transform"/>
          </xs:choice>
        </xs:choice>
        <xs:element ref="description"/>
        <xs:element ref="vMaterial"/>
      </xs:choice>
      <xs:attributeGroup ref="name-attribute"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="ellipsoid">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="radius">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="three-doubles-list">
                <xs:attributeGroup ref="length-attribute"/>
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
        <xs:element ref="vMaterial"/>
        <xs:element ref="transform"/>
      </xs:choice>
      <xs:attributeGroup ref="name-attribute"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="faceSet">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="description"/>
        <xs:element ref="vertex_normals"/>
        <xs:element ref="vertices"/>
        <xs:element ref="facets"/>
        <xs:group ref="optional-content"/>
      </xs:choice>
      <xs:attribute name="name" type="xs:token"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="facets" type="facets-content"/>
  <xs:simpleType name="facets-content">
    <xs:restriction base="integer-list"/>
  </xs:simpleType>
  <xs:element name="vertex_normals" type="vertex_normals-content"/>
  <xs:complexType name="vertex_normals-content">
    <xs:simpleContent>
      <xs:restriction base="xs:anyType">
        <xs:simpleType>
          <xs:restriction>
            <xs:simpleType>
              <xs:list>
                <xs:simpleType>
                  <xs:union>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                  </xs:union>
                </xs:simpleType>
              </xs:list>
            </xs:simpleType>
            <xs:minLength value="9"/>
          </xs:restriction>
        </xs:simpleType>
        <xs:attributeGroup ref="length-attribute"/>
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>
  <xs:element name="vertices" type="vertices-content"/>
  <xs:complexType name="vertices-content">
    <xs:simpleContent>
      <xs:restriction base="xs:anyType">
        <xs:simpleType>
          <xs:restriction>
            <xs:simpleType>
              <xs:list>
                <xs:simpleType>
                  <xs:union>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                  </xs:union>
                </xs:simpleType>
              </xs:list>
            </xs:simpleType>
            <xs:minLength value="9"/>
          </xs:restriction>
        </xs:simpleType>
        <xs:attributeGroup ref="length-attribute"/>
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>
  <xs:element name="tube" type="tube-content"/>
  <xs:complexType name="tube-content">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="spine"/>
      <xs:element ref="radius"/>
      <xs:group ref="optional-content"/>
    </xs:choice>
    <xs:attributeGroup ref="name-attribute"/>
  </xs:complexType>
  <xs:element name="spine" type="spine-content"/>
  <xs:complexType name="spine-content">
    <xs:simpleContent>
      <xs:restriction base="xs:anyType">
        <xs:simpleType>
          <xs:restriction>
            <xs:simpleType>
              <xs:list>
                <xs:simpleType>
                  <xs:union>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                  </xs:union>
                </xs:simpleType>
              </xs:list>
            </xs:simpleType>
            <xs:minLength value="6"/>
          </xs:restriction>
        </xs:simpleType>
        <xs:attributeGroup ref="length-attribute"/>
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>
  <xs:element name="sphere" type="sphere-content"/>
  <xs:complexType name="sphere-content">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="radius"/>
      <xs:element ref="position"/>
    </xs:choice>
    <xs:attributeGroup ref="name-attribute"/>
  </xs:complexType>
  <xs:element name="position" type="position-content"/>
  <xs:complexType name="position-content">
    <xs:simpleContent>
      <xs:extension base="three-doubles-list">
        <xs:attributeGroup ref="length-attribute"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:element name="box" type="box-content"/>
  <xs:complexType name="box-content">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="size"/>
      <xs:choice>
        <xs:element ref="position"/>
        <xs:element ref="transform"/>
      </xs:choice>
    </xs:choice>
    <xs:attributeGroup ref="name-attribute"/>
  </xs:complexType>
  <xs:element name="size" type="size-content"/>
  <xs:complexType name="size-content">
    <xs:simpleContent>
      <xs:extension base="three-doubles-list">
        <xs:attributeGroup ref="length-attribute"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:element name="extrusion" type="extrusion-content"/>
  <xs:complexType name="extrusion-content">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="spine"/>
      <xs:element ref="scale"/>
      <xs:element ref="crossSection"/>
      <xs:group ref="optional-content"/>
    </xs:choice>
    <xs:attributeGroup ref="name-attribute"/>
  </xs:complexType>
  <xs:element name="scale" type="scale-content"/>
  <xs:simpleType name="scale-content">
    <xs:restriction>
      <xs:simpleType>
        <xs:list>
          <xs:simpleType>
            <xs:union memberTypes="xs:double xs:double"/>
          </xs:simpleType>
        </xs:list>
      </xs:simpleType>
      <xs:minLength value="2"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="crossSection" type="crossSection-content"/>
  <xs:complexType name="crossSection-content">
    <xs:simpleContent>
      <xs:restriction base="xs:anyType">
        <xs:simpleType>
          <xs:restriction>
            <xs:simpleType>
              <xs:list>
                <xs:simpleType>
                  <xs:union>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                    <xs:simpleType>
                      <xs:union memberTypes="xs:double xs:double xs:double"/>
                    </xs:simpleType>
                  </xs:union>
                </xs:simpleType>
              </xs:list>
            </xs:simpleType>
            <xs:minLength value="9"/>
          </xs:restriction>
        </xs:simpleType>
        <xs:attributeGroup ref="length-attribute"/>
        <xs:attributeGroup ref="closed-attribute"/>
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>
  <xs:attributeGroup name="closed-attribute">
    <xs:attribute name="closed" use="required" type="xs:boolean"/>
  </xs:attributeGroup>
  <xs:group name="optional-content">
    <xs:annotation>
      <xs:documentation>global #############</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="transform"/>
        <xs:element ref="vMaterial"/>
      </xs:choice>
    </xs:sequence>
  </xs:group>
  <xs:element name="description" type="xs:string"/>
  <xs:attributeGroup name="length-attribute">
    <xs:attributeGroup ref="dimension-attribute"/>
    <xs:attributeGroup ref="Length-attribute"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="dimension-attribute">
    <xs:attribute name="dimension" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="L"/>
          <xs:enumeration value="F"/>
          <xs:enumeration value="M"/>
          <xs:enumeration value="T"/>
          <xs:enumeration value="F/L"/>
          <xs:enumeration value="F/LL"/>
          <xs:enumeration value="F/LLL"/>
          <xs:enumeration value="F/T"/>
          <xs:enumeration value="F/TT"/>
          <xs:enumeration value="F/TTT"/>
          <xs:enumeration value="L/T"/>
          <xs:enumeration value="L/TT"/>
          <xs:enumeration value="LLLLL"/>
          <xs:enumeration value="D/D"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>
  <xs:attributeGroup name="Length-attribute">
    <xs:attribute name="Length" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="meter"/>
          <xs:enumeration value="m"/>
          <xs:enumeration value="foot"/>
          <xs:enumeration value="f"/>
          <xs:enumeration value="inch"/>
          <xs:enumeration value="in"/>
          <xs:enumeration value="centimeter"/>
          <xs:enumeration value="cm"/>
          <xs:enumeration value="decimeter"/>
          <xs:enumeration value="dm"/>
          <xs:enumeration value="millimeter"/>
          <xs:enumeration value="mm"/>
          <xs:enumeration value="degree"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>
  <xs:attributeGroup name="Time-attribute">
    <xs:attribute name="Time" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="second"/>
          <xs:enumeration value="s"/>
          <xs:enumeration value="sec"/>
          <xs:enumeration value="minute"/>
          <xs:enumeration value="min"/>
          <xs:enumeration value="hour"/>
          <xs:enumeration value="hr"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>
  <xs:attributeGroup name="Force-attribute">
    <xs:attribute name="Force" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="newton"/>
          <xs:enumeration value="n"/>
          <xs:enumeration value="pound"/>
          <xs:enumeration value="grain"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>
  <xs:attributeGroup name="Mass-attribute">
    <xs:attribute name="Mass" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="kilogram"/>
          <xs:enumeration value="kg"/>
          <xs:enumeration value="gram"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>
  <xs:attributeGroup name="Dimensionless-attribute">
    <xs:attribute name="Dimensionless" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="radian"/>
          <xs:enumeration value="rad"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>
  <xs:simpleType name="three-doubles-list">
    <xs:restriction>
      <xs:simpleType>
        <xs:list>
          <xs:simpleType>
            <xs:union memberTypes="xs:double xs:double xs:double"/>
          </xs:simpleType>
        </xs:list>
      </xs:simpleType>
      <xs:length value="3"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="integer-list">
    <xs:restriction>
      <xs:simpleType>
        <xs:list>
          <xs:simpleType>
            <xs:union memberTypes="xs:integer xs:integer"/>
          </xs:simpleType>
        </xs:list>
      </xs:simpleType>
      <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:attributeGroup name="name-attribute">
    <xs:attribute name="name" use="required" type="xs:token"/>
  </xs:attributeGroup>
  <xs:attributeGroup name="description-attribute">
    <xs:attribute name="description" use="required"/>
  </xs:attributeGroup>
  <xs:element name="vMaterial">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" ref="diffuseColor"/>
        <xs:element minOccurs="0" ref="emissiveColor"/>
        <xs:element minOccurs="0" ref="specularColor"/>
        <xs:element minOccurs="0" ref="shininess"/>
        <xs:element minOccurs="0" ref="transparency"/>
        <xs:element minOccurs="0" ref="ambientIntensity"/>
        <xs:element minOccurs="0" ref="DEF"/>
        <xs:element minOccurs="0" ref="USE"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="diffuseColor" type="xs:string"/>
  <xs:element name="emissiveColor" type="xs:string"/>
  <xs:element name="specularColor" type="xs:string"/>
  <xs:element name="shininess" type="xs:string"/>
  <xs:element name="transparency" type="xs:string"/>
  <xs:element name="ambientIntensity" type="xs:string"/>
  <xs:element name="DEF" type="xs:string"/>
  <xs:element name="USE" type="xs:string"/>
</xs:schema>
