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

Problem with id usage across schema documents

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.4.0
    • 2.5.0
    • None
    • Win 2K

    Description

      I verified this with the XercesJ parser and it does NOT complain if id are unique across schema files.
      Why is ID handling different for the C++ and Java version. If we look at
      this from the XML angle, the ID should be unique only with the same document not across documents. So why is XercesC giving an error.

      Here is the response from xml schema dev mailing list
      There's no conflict. The xsd:include is not the same as an XInclude
      include. xsd:include 'includes' the schema components that belong to
      the parsed included schema document. It doesn't 'include' the xml
      representation of the included schema document, so the DTD for schemas
      is not applicable. As far as I can tell, the id attribute doesn't
      constrain the schema components (only their XML representations).

      xan

      ---------------------------------------------------------------------------------------------------------------

      For eg. if I have schema A.xsd

      <xsd:schema id="ABC">
      <xsd:include schemaLocation="B.xsd">
      <xsd:element name="x" type="xsd:string">
      </xsd:schema>

      schema B.xsd

      <xsd:schema id="ABC"> //HERE ABC value is repeated as a id
      </xsd:schema>

      If we look A.xsd as standalone XML having a id attribute it is unique.
      However if I parse A.xsd, I get an error in B.xsd saying the id attribute is
      duplicated.
      Strangely the schema spec is silent on this. Looks like the xerces schema
      parser checks ids in totality including 'includes' and 'imports'. What is
      the correct behaviour. Should this resort to a single document with an id
      like XML or consider the include and import set for id uniqueness.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bvkiran Kiran
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: