Author |
Message
|
digoshc |
Posted: Mon Nov 11, 2013 3:02 am Post subject: Define a default value for a nil value in DFDL Schema |
|
|
Apprentice
Joined: 11 Jul 2013 Posts: 25
|
Hi,
Is it possible to define a default value for a nil value in a DFDL Schema? For example, I do have a field in a record oriented text where it can have the following values: @Value@ or NULL.
The @ is the initiator and the terminator delimiter of the field, however, it will not be present if the value is NULL. So, I was thinking to use the dfdl:nilValueDelimiterPolicy=none and define the default value of a nil to NULL. Is that possible?
Env: WMB 8.0.0.2|Windows |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Nov 11, 2013 3:56 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
A simple search for
DFDL Default Value
will give you a lot of information _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 11, 2013 4:02 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I was thinking to use the dfdl:nilValueDelimiterPolicy=none and define the default value of a nil to NULL. Is that possible? |
Yes - you have correctly understood what the nilValueDelimitedPolicy is for. If the input data contain the string 'NULL' then the message tree will contain the value NULL. Otherwise, the input field must have the initiator and terminator of '@'. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
digoshc |
Posted: Mon Nov 11, 2013 5:05 am Post subject: |
|
|
Apprentice
Joined: 11 Jul 2013 Posts: 25
|
@kimbert: well, the Test Parse Model(DFDL Schema Editor) does not behave as you described or I'm missing something. My test:
the input: NULL
the element defined:
<xsd:element default="NULL" dfdl:initiator="@" dfdl:nilValueDelimiterPolicy="none" dfdl:terminator="@" ibmDfdlExtn:sampleValue="NULL" name="XXXXX" type="xsd:string"/>
the error log:
CTDP3041E: Initiator '@' not found at offset '27' for element '/YYYYY[1]/body[1]/XXXXX[1]'.
ParsedDataRegion[InfixSeparator, startOffset = 26, length = 1, scd = #xscd(/schemaElement::XXXXX/type::0/model::sequence/schemaElement::body/type::0/model::sequence)] |
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 11, 2013 7:06 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Note that a default value is not the same as a nil value. The element needs to be nillable, and you need to set up the nil-related properties. In this case you need
- nillable=true
- nilKind='nilLiteralValue'
- NilValue='NULL'
- nilValueDelimiterPolicy='none' _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
digoshc |
Posted: Mon Nov 11, 2013 4:00 pm Post subject: |
|
|
Apprentice
Joined: 11 Jul 2013 Posts: 25
|
Yeah, I was looking for the Nilvalue. It worked. Thank you. |
|
Back to top |
|
 |
|