You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Dave Thompson (Jira)" <ji...@apache.org> on 2022/02/14 19:43:00 UTC
[jira] [Closed] (DAFFODIL-2648) fn:exists fails to unparse when element does not exist
[ https://issues.apache.org/jira/browse/DAFFODIL-2648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dave Thompson closed DAFFODIL-2648.
-----------------------------------
Verified the specified commit (commit 331499562a12a741d761b518e5ae3b0838b47ba8) is included in the latest pull from the daffodil repository.
Verified changes identified in commit comments were implemented.
Verified affected daffodil sub-project sbt test suites execute successfully including the additional tests.
> fn:exists fails to unparse when element does not exist
> ------------------------------------------------------
>
> Key: DAFFODIL-2648
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2648
> Project: Daffodil
> Issue Type: Bug
> Components: Unparsing
> Affects Versions: 3.2.1
> Reporter: Steve Lawrence
> Assignee: Steve Lawrence
> Priority: Major
> Fix For: 3.3.0
>
>
> Schema:
> {code:xml}
> <annotation>
> <appinfo source="http://www.ogf.org/dfdl/">
> <dfdl:format
> ref="ex:GeneralFormat" />
> </appinfo>
> </annotation>
> <element name="root">
> <complexType>
> <sequence>
> <element name="parent">
> <complexType>
> <sequence>
> <element name="int" type="xs:int" minOccurs="0" dfdl:lengthKind="explicit" dfdl:length="1" />
> </sequence>
> </complexType>
> </element>
> <element name="term" type="xs:string"
> dfdl:lengthKind="explicit" dfdl:length="0"
> dfdl:terminator="{ if (fn:exists(../parent/int)) then 'x' else 'y' }" />
> </sequence>
> </complexType>
> </element>
> {code}
> Infoset:
> {code:xml}
> <ex:root xmlns:ex="http://example.com">
> <parent></parent>
> <term></term>
> </ex:root>
> {code}
> This infoset fails to unparse with this schema with the error
> {quote}Unparse Error: Expression Evaluation Error: Child element {}int does not exist
> {quote}
> The expected output is the letter {{y}}
> By the time the terminator expression for {{term}} is evaluated, parent should have been finalized and so we should know for sure that the {{int}} element exists or not and fn:exists should return the correct value.
> Note that if term were inside parent and after the int element, even that should still work even though parent isn't finalized yet, because this is a backwards referencing expression and so should always get an answer--we never need to wait for the int element to maybe show up or not in the infoset.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)