Re: nillable values for attributes

Hi Sean,

> Is there any discussion for allowing attribute values to have a
> “nillable” value.  I know that as XML Schemas currently stand, only
> elements may be nillable.  Plus, is there a work around for this?  Say
> I wanted an attribute with a Boolean datatype, but it could also be
> nillable.
>
> This is what I would like:
>
> <xs:attribute name=”test” type=”xs:Boolean” nillable=”true”/>
>
> So an instance document’s attribute value could contain any of the
> following and be ture:
>
> <someElement test=””/>
>
> <someElement test=”true”/>
>
> <someElement test=”false”/>

As a workaround you can create your own "nillableBoolean" type to be a
union of the built in xs:boolean type and a user defined type that only
allows the empty string "" (using <xs:enumeration value=""/>).

Cheers,
/Eddie

Received on Wednesday, 26 September 2001 19:31:18 UTC