[ 
https://issues.apache.org/jira/browse/DAFFODIL-2033?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steve Lawrence updated DAFFODIL-2033:
-------------------------------------
    Description: 
The defaultValue attribute in the dfdl:defineVariable element is allowed to 
contain either a DFDL expression or a logical value, for example, the following 
are equivalent
{code:xml}
<dfdl:defineVariable name="foo" type="xs:boolean" defaultValue="false" />
<dfdl:defineVariable name="foo" type="xs:boolean" defaultValue="{ fn:false() }" 
/>{code}
However, Daffodil always treats the defaultValue as an expression, assuming 
curly braces if they are missing. So in the case ofthe logical value, Daffodil 
tries to set the default value to
{code:xml}
{ false }{code}
Which isn't valid and result in an error. Instead, we should only treat the 
defaultValue as an expression if curly braces exist. Otherwise, we should 
convert the logical value to the the type using standard string-to-type XML 
conversion methods.

  was:
The defaultValue attribute in the dfdl:defineVariable element is allowed to 
contain either a DFDL expression or a logical value, for example, the following 
are equivalent
{code:java}
<dfdl:defineVariable name="foo" type="xs:boolean" defaultValue="false" />
<dfdl:defineVariable name="foo" type="xs:boolean" defaultValue="{ fn:false() }" 
/>{code}
However, Daffodil always treats the defaultValue as an expression, assuming 
curly braces if they are missing. So in the case ofthe logical value, Daffodil 
tries to set the default value to
{code:java}
{ false }{code}


> dfdl:defineVariable defaultType does not properly convert value
> ---------------------------------------------------------------
>
>                 Key: DAFFODIL-2033
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2033
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Middle &quot;End&quot;
>    Affects Versions: 2.3.0
>            Reporter: Steve Lawrence
>            Priority: Major
>
> The defaultValue attribute in the dfdl:defineVariable element is allowed to 
> contain either a DFDL expression or a logical value, for example, the 
> following are equivalent
> {code:xml}
> <dfdl:defineVariable name="foo" type="xs:boolean" defaultValue="false" />
> <dfdl:defineVariable name="foo" type="xs:boolean" defaultValue="{ fn:false() 
> }" />{code}
> However, Daffodil always treats the defaultValue as an expression, assuming 
> curly braces if they are missing. So in the case ofthe logical value, 
> Daffodil tries to set the default value to
> {code:xml}
> { false }{code}
> Which isn't valid and result in an error. Instead, we should only treat the 
> defaultValue as an expression if curly braces exist. Otherwise, we should 
> convert the logical value to the the type using standard string-to-type XML 
> conversion methods.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to