XML complexType with arbitrary simpleType base

Viewed 26

we are trying to save particle data in an XML format. The existing XSD code handed to me is of the form below and works more or less. However, we get problems when we try to store large unsigned long values in "DataArray_t", which seems to be due to the type (xsd:decimal) of the base of "DataArrayList_t". Since "DataArray_t" is supposed to be used for storing data of arbitrary type (int, unsigned long, but also double), I wonder if it is possible to somehow arbitrarily change the itemType of "DataArrayList_t", e.g. as an parameter given to "DataArray_t"?

    <?xml version="1.0"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">


 <xsd:simpleType name='DataArrayList_t'>
    <xsd:list itemType='xsd:decimal'/>
  </xsd:simpleType>


  <xsd:complexType name="DataArray_t">
    <xsd:simpleContent>
      <xsd:extension base="DataArrayList_t"> <!-- hier typ der daten in liste  --> 
        <xsd:attribute name="type" use="required">
          <xsd:simpleType>
            <xsd:restriction base="xsd:string">
              <xsd:enumeration value="Int8"/>
              <xsd:enumeration value="UInt8"/>
              <xsd:enumeration value="Int16"/>
              <xsd:enumeration value="UInt16"/>
              <xsd:enumeration value="Int32"/>
              <xsd:enumeration value="UInt32"/>
              <xsd:enumeration value="Int64"/>
              <xsd:enumeration value="UInt64"/>
              <xsd:enumeration value="Float32"/>
              <xsd:enumeration value="Float64"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:attribute>
        <xsd:attribute name="Name" type="xsd:string" use="required"/>
        <xsd:attribute name="NumberOfComponents" type="xsd:integer" use="required"/>
        <xsd:attribute name="format" type="xsd:string" fixed="ascii"/>
        <xsd:attribute name="offset" type="xsd:integer" use="optional"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>


  <xsd:complexType name="PieceUnstructuredGrid_t">
    <xsd:sequence>
      <xsd:element name="PointData">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="DataArray" type="DataArray_t" minOccurs="0" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="CellData">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="DataArray" type="DataArray_t" minOccurs="0" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Points">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="DataArray" type="DataArray_t" minOccurs="0" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Cells">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="DataArray" type="DataArray_t" minOccurs="0" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="NumberOfPoints" type="xsd:integer" use="required"/>
    <xsd:attribute name="NumberOfCells" type="xsd:integer" use="required"/>
  </xsd:complexType>    
0 Answers
Related