W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2002

Array Confusion

From: Brenda Bell <bbell@juicesoftware.com>
Date: Wed, 17 Jul 2002 12:43:44 -0400
Message-ID: <846B0B02E1B78B49B678EDCC00EB2962FB4F95@mail01.ent.juice.com>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
My confusion stems from some type definitions I've come across in WSDL
files, but I believe this is truly a question about XML-Schema and how types
work.

I've seen array types defined in two different ways:

Method 1:

      <s:complexType name="StringArray">
        <s:complexContent mixed="false">
          <s:restriction base="soapenc:Array">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="String"
type="s:string"/>
            </s:sequence>
          </s:restriction>
        </s:complexContent>
      </s:complexType>

Method 2:

      <xs:complexType name="DoubleArray">
        <xs:complexContent>
          <xs:restriction base="soapenc:Array">
            <xs:sequence/>
            <xs:attribute ref="soapenc:arrayType" n1:arrayType="xs:double[]"
xmlns:n1="http://schemas.xmlsoap.org/wsdl/"/>
          </xs:restriction>
        </xs:complexContent>
      </xs:complexType>
    </xs:schema>

Method 1 makes perfect sense... given the following element declaration:

  <xs:element name="TestStrings">
    <xs:complexType>
    <xs:sequence>
      <xs:element name="Data" type="tns:StringArray"></xs:element>
    </xs:sequence>
    </xs:complexType>
  </xs:element>

This document is valid (at least, it's valid in XMLSpy :):

<TestStrings>
  <Data>
    <String>abc</String>
    <String>xyz</String>
  </Data>
</TestStrings>


However, method 2 has me baffled... given the following element declaration:

  <xs:element name="TestDoubles">
    <xs:complexType>
    <xs:sequence>
      <xs:element name="Data" type="tns:DoubleArray"></xs:element>
    </xs:sequence>
    </xs:complexType>
  </xs:element>

I haven't been able to come up with a valid document.  The Data element
isn't allowed to have text, but the sequence on DoubleArray is empty and
doesn't allow child elements.  What am I missing?

Brenda Bell
Sr. Software Architect
Juice Software, Inc.
Phone: 603.428.3994
Cell:  603.494.8206
Fax:   603.428.8713
Email: bbell@juicesoftware.com
MSN:   bbell@theotherbell.com
Received on Wednesday, 17 July 2002 12:45:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:04 UTC