|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
DFDL Modelling Fixed length optional elements |
« View previous topic :: View next topic » |
Author |
Message
|
vishnurajnr |
Posted: Thu Apr 03, 2014 5:45 am Post subject: DFDL Modelling Fixed length optional elements |
|
|
 Centurion
Joined: 08 Aug 2011 Posts: 134 Location: Trivandrum
|
Hi,
I would like to know the modelling in DFDL for a fixed length element which is optional. I am unable to model such element.
my message for ex: ABC123DEF456GHI (Each element is of length 3 and there are 5 elements. This structure is repeating, maxOccurs='UnBounded' and separated by CRLF)
In the above message the last two elements may not be present (Optional) in all records.
Eg:
Code: |
ABC123DEF456GHI
ABC123DEF456GHI
ABC123DEF
ABC123DEF
ABC123DEF456GHI |
is it possible to model such a structure in DFDL? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Apr 03, 2014 7:12 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Yes, it is possible.
If you are using IIB v9 then you can set Length Kind='pattern' and use a regex to extract the data. If the regex returns a zero-length match then the field is assumed to be missing.
If you are using WMB v8 then you will have to add a DFDL assert to the each optional fields. The expression in the assert should check that the field does not start with a line break character. _________________ 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 |
|
 |
vishnurajnr |
Posted: Thu Apr 03, 2014 8:28 am Post subject: |
|
|
 Centurion
Joined: 08 Aug 2011 Posts: 134 Location: Trivandrum
|
Thanks a lot kimbert... I m using v8 (8.0.0.3).
Will try the option given by you tomorrow. .  |
|
Back to top |
|
 |
vishnurajnr |
Posted: Fri Apr 04, 2014 12:25 am Post subject: |
|
|
 Centurion
Joined: 08 Aug 2011 Posts: 134 Location: Trivandrum
|
Hi,
I found the optional data is present/absent based on the value of second element in the same record.
eg: ABC123DEF456GHI (all elements available since second element vale is 123)
ABC456DEF (last 2 elements not available since second element value is 456).
hence I used the occurs count kind property on the optional elements as below:
Quote: |
dfdl:occursCount="{if (fn:contains(/EATRANOP/EATRANOPREC/ATTRTY , '456') )then 1 else 0 }" |
.
Now the problem is the xpath expression is always taking the first record (Index always 1) and I need to have the path as /EATRANOP[1]/EATRANOPREC[currentIndex]/ATTRTY.
Similar issue if I m using the Assert-expression as well. Eg:
Code: |
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:assert message="Its not a line Break" test="{fn:not(fn:starts-with(/EATRANOP/EATRANOPREC/ATSFCI , '%CR;%LF;')) }"/>
</xsd:appinfo>
</xsd:annotation> |
(ATSFCI is the optional element)
The above expression will always take the first index record only for evaluation.
Is there any way to achieve the same (to get index dynamically)? |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|