Re: [xml] Possible bug in libxml?



Hi,

this was a bug fixed on 2005-02-15; it's in the CVS.

xmllint --noout --schema nillable1_0.xsd nillable1_0.xml
nillable1_0.xml validates

xmllint --version
xmllint: using libxml version 20617CVS2356
compiled with: DTDValid FTP HTTP HTML C14N Catalog XPath XPointer XInclude Iconv Unicode Regexps Automata Schemas Modules

Regards,

Kasimier

Jeroen Ruigrok/asmodai wrote:
Daniel asked me to send to the list.

testcase.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
  elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xsd:element name="test">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="date" nillable="true" type="xsd:date"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

testcase.xml:

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
  xsi:noNamespaceSchemaLocation="testcase.xsd">
  <date xsi:nil="true"></date>
</test>

$ xmllint --schema testcase.xsd testcase.xml
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xsi:noNamespaceSchemaLocation="testcase.xsd">
  <date xsi:nil="true"/>
</test>
testcase.xml:5: element date: Schemas validity error : Element 'date' ['date']: The character content is not 
valid.
testcase.xml fails to validate

$ xmllint --version
xmllint: using libxml version 20617
   compiled with: DTDValid FTP HTTP HTML C14N Catalog XPath XPointer XInclude Iconv Unicode Regexps Automata 
Schemas

For all the documentation that I have been able to find an xsd:date typed
element should also be nillable.
Even Jeni used it:
http://lists.w3.org/Archives/Public/xmlschema-dev/2002Nov/0108.html

Reading the specification it seems that it makes no distinction which types
can be nillable and which not:

http://www.w3.org/2001/XMLSchema.dtd:

<!ATTLIST %element;
            name               %NCName;               #IMPLIED
            id                 ID                     #IMPLIED
            ref                %QName;                #IMPLIED
            type               %QName;                #IMPLIED
            minOccurs          %nonNegativeInteger;   #IMPLIED
            maxOccurs          CDATA                  #IMPLIED
            nillable           %boolean;              #IMPLIED
            substitutionGroup  %QName;                #IMPLIED
            abstract           %boolean;              #IMPLIED
            final              %complexDerivationSet; #IMPLIED
            block              %blockSet;             #IMPLIED
            default            CDATA                  #IMPLIED
            fixed              CDATA                  #IMPLIED
            form               %formValues;           #IMPLIED
            %elementAttrs;>

Ideas?  Am I doing something wrong here in my schema or is it a genuine bug?

Kind regards,





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]