[
https://issues.apache.org/jira/browse/DAFFODIL-2393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17678302#comment-17678302
]
Steve Lawrence commented on DAFFODIL-2393:
------------------------------------------
I am able to reproduce the issue when trying to compile this schema:
{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:ex="https://example.com"
targetNamespace="https://example.com">
<include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<annotation>
<appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format xmlns="" ref="GeneralFormat" />
</appinfo>
</annotation>
<element name="e1">
<complexType>
<sequence>
<element name="value1" type="xs:string" dfdl:lengthKind="explicit"
dfdl:length="1" />
<!--
<element name="foo">
<complexType>
<sequence>
<group ref="ex:unused_group" />
</sequence>
</complexType>
</element>
<element name="bar" type="ex:unused_complex_type" />
<element ref="ex:unused_element" />
-->
</sequence>
</complexType>
</element>
<group name="unused_group">
<sequence>
<sequence dfdl:terminator="{ ../value1 }" />
</sequence>
</group>
<complexType name="unused_complex_type">
<sequence>
<sequence dfdl:terminator="{ ../value1 }"/>
</sequence>
</complexType>
<element name="unused_element">
<complexType>
<sequence>
<sequence dfdl:terminator="{ ../value1 }"/>
</sequence>
</complexType>
</element>
</schema>
{code}
The issue is that unused_group/complex_type/element are not referenced from the
root e1 element. Daffodil compiles all top level elements but doesn't have any
context to know how to compile these expressions in these unused elements where
the expressions break out of the top-level element. So it errors about going
past the root.
Instead, we likely want to implement a similar fix as DAFFODIL-2654, where we
output warning if we cannot compile an expression because we don't have any
context about where it's used. Note that we do still want an SDE if an
expression in a used element goes out past the root. This warning should only
occur for expressions in unused elements/complex types/groups.
Also note that the workaround is to comment out any unused elements/complex
types/groups.
> relative path past root - incorrect error
> -----------------------------------------
>
> Key: DAFFODIL-2393
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2393
> Project: Daffodil
> Issue Type: Bug
> Components: Middle "End"
> Affects Versions: 2.6.0
> Reporter: Mike Beckerle
> Assignee: Steve Lawrence
> Priority: Minor
> Labels: reverify
> Fix For: 3.5.0
>
>
> A complex type containing an expression with a path having path steps upward
> and out of the element into surrounding elements fails with relative path
> past root error.
> Discovered working on JANAP-128 schema. (Worked around by moving expression
> outside the complex type.)
> Test case TBD.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)