Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1952

Different validation results for different empty element syntax: <e xsi:nil="true" /> vs. <e xsi:nil="true"></e>

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.0, 3.0.1, 3.1.0, 3.1.1, 3.1.2, 3.2.0, 3.1.3, 3.1.4
    • 4.0.0
    • None
    • Windows Vista

    Description

      In case of <e xsi:nil="true"></e> syntax for empty element used, XSD validation reports follow message

      Message: element 'subitem' is nil and must be empty

      In case empty element defined as <e xsi:nil="true" /> there is no validation error.

      XML file:
      ===
      <?xml version="1.0"?>
      <note xmlns="http://www.test"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.test note.xsd">
      <item>
      <subitem>
      <A>text1</A>
      <e xsi:nil="true"></e>
      <C>text2</C>
      </subitem>
      </item>
      </note>
      ===

      XSD file:
      ===
      <?xml version="1.0"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns="http://www.test"
      elementFormDefault="qualified"
      targetNamespace="http://www.test">

      <xs:element name="note">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="item">
      <xs:complexType>
      <xs:sequence>
      <xs:element name="subitem" nillable="true" type="xs:anyType" minOccurs="0" />
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>

      </xs:schema>
      ===

      Attachments

        1. xerces-nillable2.patch
          28 kB
          Martin Raiber
        2. xerces-nillable2.patch
          19 kB
          Martin Raiber
        3. note.xsd
          0.7 kB
          Alexey Miroshnichenko
        4. note.xml
          0.3 kB
          Alexey Miroshnichenko

        Issue Links

          Activity

            People

              Unassigned Unassigned
              alexeyme Alexey Miroshnichenko
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: