Author |
Message
|
Dave Ziegler |
Posted: Mon May 05, 2014 12:02 pm Post subject: How do I ignore a blank last line in DFDL? |
|
|
Centurion
Joined: 15 Apr 2014 Posts: 118
|
I have a three-line input file like this:
TEST 1
TEST 2
TEST 3
[blank line here]
How do I instruct the DFDL parser to ignore that blank last line and not throw this:
May 5, 2014, 3:01:04 PM fatal: CTDP3002E: Unexpected data found at offset 'blah' after parsing completed. Data: '0x0d...'. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon May 05, 2014 1:02 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Set the group terminator to new line, can be omitted.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Dave Ziegler |
Posted: Mon May 05, 2014 1:24 pm Post subject: |
|
|
Centurion
Joined: 15 Apr 2014 Posts: 118
|
Can you be more specific? The wizard gave me 4 levels:
MyFormat
..sequence
....body
......sequence
........data elements start here
I can set terminators and initiators at each of these levels. I tried setting Terminator at a couple of these levels to {$dfdl:outputNewLine} but I can't change Document Final Terminator Can Be Missing from 'no'. |
|
Back to top |
|
 |
Dave Ziegler |
Posted: Mon May 05, 2014 1:54 pm Post subject: |
|
|
Centurion
Joined: 15 Apr 2014 Posts: 118
|
I might have accidentally gotten this to work. There were a bunch of extra settings specified at those various levels I mentioned once I exited the wizard. I tweaked each of those (i.e. removed most of them), and just set CRLF at the sequence level just above the data elements. Things appear to be working now... will keep working and post back here if problems arise. |
|
Back to top |
|
 |
kimbert |
Posted: Mon May 05, 2014 2:40 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You need to model the final newline character(s) as a terminator ( not a separator ), and then make sure that you set documentFinalTerminatorCanBeMissing="yes".
You can still model the other newlines as separators if you like - just make sure that the optional terminator is defined on the outermost element. _________________ 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 |
|
 |
Dave Ziegler |
Posted: Wed May 07, 2014 9:46 am Post subject: |
|
|
Centurion
Joined: 15 Apr 2014 Posts: 118
|
kimbert wrote: |
You need to model the final newline character(s) as a terminator ( not a separator ), and then make sure that you set documentFinalTerminatorCanBeMissing="yes".
You can still model the other newlines as separators if you like - just make sure that the optional terminator is defined on the outermost element. |
Thanks for the reply... I'm looking around, but not seeing the documentFinalTerminatorCanBeMissing property. And when you say final newline character, would that be on the outermost element, or the body, or...?
(total noob) |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 07, 2014 11:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Should be on the first sequence, I think.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Dave Ziegler |
Posted: Wed May 07, 2014 11:24 am Post subject: |
|
|
Centurion
Joined: 15 Apr 2014 Posts: 118
|
It must be hidden well because I can't find it. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed May 07, 2014 12:02 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Looks like it is on the data format, and can only be changed thereon.
Collapse all sections of your DFDL document..., navigate to the format section and edit or copy your data format.
On the dataformat details you will find Document Final terminator can be missing: set the value to yes
If your record is defined by a terminator, you will see the terminator has children. The omit last terminator is a child of the terminator...
Apply the dataformat you created to the message / sequence where you defined the documents Final Terminator...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Dave Ziegler |
Posted: Wed May 07, 2014 12:55 pm Post subject: |
|
|
Centurion
Joined: 15 Apr 2014 Posts: 118
|
Are you using V9? I'm not seeing this at all... |
|
Back to top |
|
 |
Dave Ziegler |
Posted: Wed May 07, 2014 1:13 pm Post subject: |
|
|
Centurion
Joined: 15 Apr 2014 Posts: 118
|
Show all sections at the top... ah... very handy! |
|
Back to top |
|
 |
vishnurajnr |
Posted: Wed May 07, 2014 8:06 pm Post subject: |
|
|
 Centurion
Joined: 08 Aug 2011 Posts: 134 Location: Trivandrum
|
http://www.mqseries.net/phpBB2/viewtopic.php?t=65273&highlight=dfdl
Kimbert wrote: |
You can set the 'documentFinalTerminatorCanBeMissing' property as follows:
- Click the 'Show all sections' button at the top of the DFDL editor
- Find the 'Data Formats' section
- Click on the <default format> entry
- You should now see the full set of DFDL properties display in the 'Representation properties' view on the right hand side.
- Find the 'Delimiters' section. The property 'DocumentFinalTerminatorCanBeMissing' is listed there.
After changing the property and saving, feel free to look at the xsd in a text editor. You should find that the anonymous format block for the schema has been changed to include the new property. |
|
|
Back to top |
|
 |
|