Steve Hanson | Hi Sandy - please can you ping back when free ? Ta! |
Sandy (S.) Gao | hi steve |
Steve Hanson | Hi |
◄
| From DFDL WG call today... |
◄
| 2.
What is correct syntax for setting the value of a variable to empty string?
DFDL variables allow both XSDL lexical form and DFDL expressions as values, so it seems plausible that <dfdl:setVariable ref="x" value=""/> or even <dfdl:setVariable ref="x"/> is an allowed syntax for setting the value of a string or hexBinary variable to empty string |
◄
| What's your opinion here? |
◄
| Syntax for setting a DFDL variable to empty string. |
Sandy (S.) Gao | the first looks reasonable. if you want to distinguish between an unset value / null value vs. empty value, then you may not want to use the second. in xml, there's a difference between an attribute that's not present and an attribute with empty value. |
◄
| unless you are using element content as the value for the second case. |
Steve Hanson | That's the issue - DFDL treats the attr form and element form as equivalent |
Sandy (S.) Gao | so for non-empty value, you could <setV ... value="abc"/> or <setV ...>abc</setV>? |
Steve Hanson | correct |
Sandy (S.) Gao | ic... then i suppose you need to be consistent and allow both of those forms. |
◄
| but can someone specify a null value? or unset a variable? |
Steve Hanson | null not allowed |
◄
| I don't think we allow unsetting either |
◄
| Good points though |
Sandy (S.) Gao | if a value is required, then i don't see any issue in this approach. |
Steve Hanson | ok - I will raise the unset issue, as we don't want to box ourselves in for future |
◄
| thanks Sandy |
Sandy (S.) Gao | np... i guess you'll need to add a new element e.g. <unsetValue> or a special value <setV...>##unset</setV> to support it. |
Steve Hanson | yes - if we don't allow the empty element + missing attr to mean that |
Sandy (S.) Gao | exactly |