You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by th...@ascentialsoftware.com on 2003/03/19 19:33:58 UTC

nillable element with default values

I am wondering if this is a Xerces bug or something that I missed in the XML
Schema specification.
Using the following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://my.company.com"
            xmlns="http://my.company.com"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="root">
        <xsd:complexType>
            <xsd:sequence>
	    <xsd:element name="elem1" default="elem1 default"
nillable="true">
                    <xsd:complexType>
                        <xsd:simpleContent>
                            <xsd:extension base="xsd:string"/>
                        </xsd:simpleContent>
                    </xsd:complexType>    
                </xsd:element>
	</xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

And the following document:

<?xml version="1.0" encoding="UTF-8"?>
<ns:root xmlns:ns="http://my.company.com"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://my.company.com nillable.xsd">
  <elem1 xsi:nil="true"/>
</ns:root>

I get an error message from Xerces when parsing the document: "Message:
Element elem1 with attribute xsi:nil=true must be empty"
I check the XML Schema specification. It is explicitly said that if nillable
is true you can not have a fixed value, but I did not find anything related
to default values which is what I have in my case (elem1 as a default value
declared in the schema). Any ideas?

Thanks in advance for any help.

Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org