Author |
Message
|
msnyder |
Posted: Thu May 10, 2012 5:21 am Post subject: DFDL hex initiators |
|
|
Apprentice
Joined: 24 May 2002 Posts: 32 Location: Jacksonville, FL
|
I have a situation where record types are identified by 2 byte little endian integers. The parser is not finding a choice branch when the initiator is specified as a hex value, e.g. dfdl:initiator="%#x0411;" for a record type of 1041. From the documentation, it seems this should be supported. Is this correct or do initiators have to be text in this version? |
|
Back to top |
|
 |
kimbert |
Posted: Thu May 10, 2012 5:42 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Technically, the initiator property is a DFDL string literal. The DFDL entity "%#x0411;" is specifying a 'HexadecimalCodePoint' according to section 6.3.1.2 of the DFDL specification : http://www.ogf.org/dfdl/DFDL_1.0_Web/dfdl_6_3.html
But you do not want to specify a Unicode code point - you want to specify two raw bytes. To do that, you need two DFDL byte value entities, as specified in section 6.3.1.4. Like this:
|
|
Back to top |
|
 |
msnyder |
Posted: Thu May 10, 2012 5:45 am Post subject: |
|
|
Apprentice
Joined: 24 May 2002 Posts: 32 Location: Jacksonville, FL
|
Yes, I tried that but got an exception saying something to the effect that it is not supported in the IBM implementation. |
|
Back to top |
|
 |
msnyder |
Posted: Thu May 10, 2012 5:52 am Post subject: |
|
|
Apprentice
Joined: 24 May 2002 Posts: 32 Location: Jacksonville, FL
|
After further review, I tried it like
and got the aforementioned exception. According to the spec, 1 or more pairs is acceptable. However, after separating into 2, the exception is no more but a branch is not found. |
|
Back to top |
|
 |
kimbert |
Posted: Thu May 10, 2012 6:01 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
According to the spec, 1 or more pairs is acceptable. |
I assume you are referring to this sentence: "To specify a string of byte values, a sequence of two or more byte value entities must be used."
I think it is trying to say that you need exactly one entity per raw byte. But the wording could be clearer.
Quote: |
after separating into 2, the exception is no more... |
OK - that's a relief.
Quote: |
but a branch is not found |
Have you looked at the DFDL trace yet? Any clues there? |
|
Back to top |
|
 |
kimbert |
Posted: Thu May 10, 2012 6:11 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I've just tried this out, and it works for me. Might be worth changing the order of the two %#r entities in case my attempt at a littleEndian integer was wrong. |
|
Back to top |
|
 |
msnyder |
Posted: Thu May 10, 2012 7:04 am Post subject: |
|
|
Apprentice
Joined: 24 May 2002 Posts: 32 Location: Jacksonville, FL
|
Yes I noticed that it was backwards. However, I had added another byte to the mix and miskeyed it. After changing, it worked like a charm. Thanks for your help. |
|
Back to top |
|
 |
|