Hi Steve,

well the problem is that I don't have the parent length in the current context.

Without it, it doesn't seem to work.

If there was some sort of global variable providing the total length of the 
entire input, that would be awesome.
As I mentioned, the length information in in the surrounding protocol, I wanted 
to model them all as separate as possible.

Would it be possible to implement lengthKind="endOfParent"? Would it be a lot 
of work? Could I help with it?

Chris



Am 22.01.19, 15:48 schrieb "Steve Lawrence" <[email protected]>:

    Correct, lengthKind="endOfParent" has not bee implemented yet.
    
    As an alternative that we do support, you should be able to use
    dfdl:lengthKind="delimited" for the hexBinary user data. In this case,
    there's no delimiter, but parent length sort of acts like one. For example:
    
      <xs:element name="Parent"
        dfdl:lengthKind="explicit" dfdl:length="4"
        dfdl:lengthUnits="bytes">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="Header" type="xs:hexBinary"
              dfdl:lengthKind="explicit" dfdl:length="1"
              dfdl:lengthUnits="bytes" />
            <xs:element name="UserData" type="xs:hexBinary"
              dfdl:lengthKind="delimited" dfdl:encoding="ISO-8859-1"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    
    So the parent element is 4 bytes and the header is 1 byte. If we parse
    the data:
    
      0xAA BB CC DD
    
    We get the following infoset
    
      <Parent>
        <Header>AA</Header>
        <UserData>BBCCDD</UserData>
      </Parent>
    
    And the UserData is the remaining three bytes. Using
    lengthKind="endOfParent" would probably have better performance if we
    implemented it, but this should give the same result for the hexBinary
    blob at the end.
    
    - Steve
    
    
    On 1/22/19 4:16 AM, Christofer Dutz wrote:
    > Hi all,
    > 
    > I am stuck with a little problem … I am reading a packet, which is 
usually contained inside another. Therefore it doesn’t provide any means of 
providing it’s length.
    > So the packet is just a small header + binary data … now I want to read 
“all the rest” after the header into a field “userData”.
    > In the DFDL documentation at IBM I could read that the 
lengthKind=”endOfParent” would be what I’m looking for.
    > 
    > Unfortunately this doesn’t seem to be supported … so how can I achieve 
the same with implemented options?
    > 
    > Chris
    > 
    
    

Reply via email to