You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Mike Beckerle (Jira)" <ji...@apache.org> on 2020/06/10 16:54:00 UTC
[jira] [Commented] (DAFFODIL-2352) dfdl:newVariableInstance with
non-constant defaultValue fails
[ https://issues.apache.org/jira/browse/DAFFODIL-2352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17130931#comment-17130931 ]
Mike Beckerle commented on DAFFODIL-2352:
-----------------------------------------
This style of using dfdl:newVariableInstance with a defaultValue to both create the new instance and provide the formula for evaluating its value, all in one statement, is probably the preferred idiom. (versus two statements - a second statement to set the value).
> dfdl:newVariableInstance with non-constant defaultValue fails
> -------------------------------------------------------------
>
> Key: DAFFODIL-2352
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2352
> Project: Daffodil
> Issue Type: Bug
> Components: Back End
> Affects Versions: 2.6.0
> Reporter: Steve Lawrence
> Priority: Major
>
> If we have a schema with newVariableInstance that uses a non-constant DFDL expression for the default value, that default value is never set. For example:
> {code:xsd}
> <xs:sequence>
> <xs:annotation>
> <xs:appinfo source="http://www.ogf.org/dfdl/">
> <dfdl:newVariableInstance ref="foo" defaultValue="{ /some/non/constant/thing }" />
> </xs:appinfo>
> </xs:annotation>
> <xs:element name="fooValue" type="xs:int" dfdl:inputValueCalc="{ $foo }" /> </xs:sequence>
> {code}
> When the inputValueCalc expressoin is evaluated, we fail with the error
> {code}
> Runtime Schema Definition Error: Variable Error: Variable map (runtime): variable foo has no value. It was not set, and has no default value.
> {code}
> According to the spec:
> {code}
> If a default value is specified this initial value of the instance will be set when the instance is created
> {code}
> So we are likely just missing the logic to evaluate and set the default when when we create the new VariableInstacne.
> This might also affect dfdl:defineVariable as well, which is allowed to also have expressions as the defaultValue, as long as the expression doesn't reference the infoset and only other variables.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)