W3C home > Mailing lists > Public > xml-dist-app@w3.org > April 2001

Re: SOAP spec Sec "5.4.2 Arrays" - namespace used in qualifying array elements in a SOAP sample is not correct

From: <Noah_Mendelsohn@lotus.com>
Date: Thu, 12 Apr 2001 16:54:22 -0400
To: "Affan Dar" <affandar@microsoft.com>
Cc: xml-dist-app@w3.org
Message-ID: <OFB6F78576.3ABCDA48-ON85256A2C.00686FB8@lotus.com>
Affan Dar writes:

>> As I understand - 'xsd' cannot be used to qualify 
>> elements in an instance document. It should be 
>> SOAP-ENC:string instead of xsd:string.

I'm sorry, but your understanding is not correct.  Not only can types from 
the XML schema datatypes be used, there are common circumstances in which 
they should be.  First of all from the SOAP spec [1]:

"Throughout this document, the namespace prefix "xsi" is assumed to be 
associated with the URI "http://www.w3.org/1999/XMLSchema-instance" which 
is defined in the XML Schemas specification [11]. Similarly, the namespace 
prefix "xsd" is assumed to be associated with the URI 
"http://www.w3.org/1999/XMLSchema" which is defined in [10]."

As always in XML, you can use any prefix you like, it's the associated URI 
that matters.  I'll use the same convention here.

That said, if you want to tell me that something is an integer, the right 
way to do it is:

        <AGE xsi:type="xsd:integer">12</age>

The precise definition of the xsi:type attribute is found at [2], and a 
more informal introduction can be foundin the schema primer at [3]. 

As far as I know (I'm disconnected at the moment and can't easily check), 
SOAP-ENC:string is an element declaration, not a type.  Predefined 
elements such as SOAP-ENC:string are indeed useful in certain specific 
situations, such as in certain arrays, but there is nothing wrong with 
using xsi:type and the built in (or user defined, if you know that schemas 
are around) types.  Of course, if you use user-defined types, you may 
cause some challenges for certain dynamically typed non-schema-aware 
environements (certain script based implementations, for example).

Hope this is helpful.

[1] http://www.w3.org/TR/SOAP/#_Toc478383489
[2] http://www.w3.org/TR/xmlschema-1/
[3] http://www.w3.org/TR/xmlschema-0/

Noah Mendelsohn                                    Voice: 1-617-693-4036
Lotus Development Corp.                            Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
Received on Thursday, 12 April 2001 16:57:00 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 22:01:12 UTC