Steve Lawrence created DAFFODIL-2857:
----------------------------------------
Summary: Different prefixes for same namespace fails to compile
wih dfdlx:repType
Key: DAFFODIL-2857
URL: https://issues.apache.org/jira/browse/DAFFODIL-2857
Project: Daffodil
Issue Type: Bug
Components: Front End
Reporter: Steve Lawrence
Say we have these two schemas:
*foo.dfdl.xsd*
{code:xml}
<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>
{code}
*bar.dfdl.xsd*
{code:xml}
<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>
{code}
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".
--
This message was sent by Atlassian Jira
(v8.20.10#820010)