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

Anytype prevent identity constraint application

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.0
    • None
    • None
    • Linux 2.6.5-7.244-smp x86_64 GNU/Linux

    Description

      ID declaration is not found when it is enclosed in two levels of anytype elements.
      In this example :
      <?xml version="1.0" encoding="utf-8"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
      <xs:element name="bigBadWolf">
      <xs:complexType>
      <xs:sequence maxOccurs="unbounded">
      <xs:element name="eat">
      <xs:complexType>
      <xs:attribute name="ref" type="xs:IDREF"/>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      <xs:element name="littlePig">
      <xs:complexType>
      <xs:attribute name="id" type="xs:ID"/>
      </xs:complexType>
      </xs:element>
      <xs:element name="world">
      <xs:complexType>
      <xs:all>
      <xs:element name="strawHouse"/>
      <xs:element name="stickHouse"/>
      <xs:element name="brickHouse"/>
      <xs:element ref="bigBadWolf"/>
      </xs:all>
      </xs:complexType>
      </xs:element>
      </xs:schema>

      <?xml version="1.0" encoding="UTF-8"?>
      <world xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="anytype_prevent_id_constraint.xsd">
      <strawHouse>
      <littlePig id="first"/>
      </strawHouse>
      <stickHouse>
      <littlePig id="second"/>
      </stickHouse>
      <brickHouse>
      <thickWall>
      <littlePig id="third"/>
      </thickWall>
      </brickHouse>
      <bigBadWolf>
      <eat ref="first"/>
      <eat ref="second"/>
      <eat ref="third"/>
      </bigBadWolf>
      </world>

      Validation fails with error "ID attribute 'third' was referenced but never declared". Same kind of problem can be reproduced with unique/key and keyref and it also prevent duplicate id detection.
      From my investigations in IGXMLScanner , at the brickHouse level, modelType == SchemaElementDecl::Any will set laxThisOne to true. Then at the thickWall level, laxThisOne set fValidate to false. And this disable the call to fICHandler->activateIdentityConstraint.
      My text editor using XercesJ 2.9.1 does not suffer from this bug.

      Attachments

        1. anytype_prevent_id_constraint.xsd
          1.0 kB
          Thomas Carcaud
        2. anytype_prevent_id_constraint.xml
          0.5 kB
          Thomas Carcaud

        Activity

          People

            Unassigned Unassigned
            tcarcaud Thomas Carcaud
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: