Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2857

Different prefixes for same namespace fails to compile with dfdlx:repType

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.6.0
    • Front End
    • None

    Description

      Say we have these two schemas:

      foo.dfdl.xsd

      <schema
        xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
        xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
        xmlns:foo="http://example.com/"
        targetNamespace="http://example.com/"
        elementFormDefault="unqualified">
      
        <include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd" />
      
        <include schemaLocation="bar.dfdl.xsd" />
      
        <annotation>
          <appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:format ref="foo:GeneralFormat" representation="binary" />
          </appinfo>
        </annotation>
      
        <element name="foo" type="foo:NumEnums" />
      
      </schema>
      

      bar.dfdl.xsd

      <schema
        xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
        xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
        xmlns:bar="http://example.com/"
        targetNamespace="http://example.com/"
        elementFormDefault="unqualified">
      
        <include schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd" />
      
        <annotation>
          <appinfo source="http://www.ogf.org/dfdl/">
            <dfdl:format ref="bar:GeneralFormat" representation="binary" />
          </appinfo>
        </annotation>
      
        <simpleType name="enum" dfdl:lengthKind="explicit" dfdl:length="1">
          <restriction base="xs:int" />
        </simpleType>
      
        <simpleType name="NumEnums" dfdlx:repType="bar:enum">
          <restriction base="xs:string">
            <enumeration value="zero" dfdlx:repValues="0"/>
            <enumeration value="one" dfdlx:repValues="1"/>
          </restriction>
        </simpleType>
      
      </schema>
      

      Note that foo.dfdl.xsd and bar.dfdl.xsd use the same targetNamespace, but have different namespace prefixes.

      Trying to compile this schema causes the error:

      > [error] Schema Definition Error: Undefined QName prefix 'bar'

      Likely what is happening is we create a quasi element in the scope foo.dfdl.xsd that has its type set to that of its dfdlx:repType property, which is "bar:enum". But in that scope, "bar:enum" doesn't make sense because the "bar" prefix isn't defined, the namespace prefix in this scope is "foo".

      Attachments

        Activity

          People

            Unassigned Unassigned
            slawrence Steve Lawrence
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: