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

RE: nil="true" and xsi:type="xsd:string"

From: Tom Preston <tpreston@amadeusboston.com>
Date: Fri, 1 Mar 2002 16:47:33 -0500
Message-ID: <498B0C8F9141D511927B009027B113874E98E5@email-temp.amadeusboston.com>
To: Stanley Guan <stanley.guan@oracle.com>, xmlschema-dev@w3.org
Sorry,  hit send by mistake::

hum...so the page says that it shouldn't be valid, and yet it passes

I don't know why it would be wrong:

spec says:
2.6.1 xsi:type
The Simple Type Definition (§ or Complex Type Definition (§
used in ·validation· of an element is usually determined by reference to the
appropriate schema components. An element information item in an instance
may, however, explicitly assert its type using the attribute xsi:type. The
value of this attribute is a ·QName·; see QName Interpretation (§3.15.3) for
the means by which the ·QName· is associated with a type definition. 

"anySimpleType can be considered as the ·base type· of all ·primitive·
types. "

section 3 of 
says that string falls under anySimpleType.

Maybe if you set nil to "true" you shouldn't specify a type? :

2.6.2 xsi:nil
XML Schema: Structures introduces a mechanism for signaling that an element
should be accepted as ·valid· when it has no content despite a content type
which does not require or even necessarily allow empty content. An element
may be ·valid· without content if it has the attribute xsi:nil with the
value true. An element so labeled must be empty, but can carry attributes if
permitted by the corresponding complex type.

Seems to say that the type attribute should be acceptable.

So, I don't know why it should fail...


-----Original Message-----
From: Stanley Guan [mailto:stanley.guan@oracle.com]
Sent: Friday, March 01, 2002 12:36 PM
To: xmlschema-dev@w3.org
Cc: Schema XML; schema-ig w3c
Subject: Re: nil="true" and xsi:type="xsd:string"


If you follow the following link and look the row for elemZ001, you can find
expected result:
which is invalid!

As I recall, Henry has posted that:
   * xs:string is not a valid restriction of xs:anySimpleType.  (ht)



Tom Preston wrote:

> For me it validated with strict validation in XSV and it validated with
> xerces 144 and xerces 200.  Doesn't seem to be invalid.
> Tom
> -----Original Message-----
> From: Stanley Guan [mailto:stanley.guan@oracle.com]
> Sent: Thursday, February 28, 2002 6:23 PM
> To: Schema XML; schema-ig w3c
> Subject: xsi:nil="true" and xsi:type="xsd:string"
> Hi,
> Can someone shed some light on why elemZ001.xml is invalid?
> (see
> m)
> Thx,
> -Stanley
> elemZ001.xsd
> ----------------
> <?xml version="1.0"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  <xsd:element name="root">
>   <xsd:complexType>
>    <xsd:sequence>
>     <xsd:element ref="uid" maxOccurs="unbounded"/>
>    </xsd:sequence>
>   </xsd:complexType>
>  </xsd:element>
>  <xsd:element name="uid" nillable="true"/>
> </xsd:schema>
> elemZ001.xml
> ----------------
> <?xml version="1.0"?>
> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xsi:noNamespaceSchemaLocation="elemZ001.xsd">
>  <uid xsi:nil="true" xsi:type="xsd:string"/>
>  <uid xsi:nil="true"/>
> </root>
Received on Friday, 1 March 2002 16:47:37 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:55 UTC