ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » DFDL parser initiator issue

Post new topic  Reply to topic
 DFDL parser initiator issue « View previous topic :: View next topic » 
Author Message
petervh1
PostPosted: Fri Nov 19, 2021 7:24 am    Post subject: DFDL parser initiator issue Reply with quote

Centurion

Joined: 19 Apr 2010
Posts: 122

Hi

I have a file like this:
Quote:
*** START OF /nnn/nnn/Branch/123456 [LF]
101011891084080939202109240000010O00000003027 [LF]
101011891084080939202109240000010O00000003028 [LF]
--- END OF /nnn/nnn/Branch/123456 [LF]
Z300154851[LF]


I've set up the XSD as follows:
Quote:

1 header - implicit length, element delimited by [LF]
Unbounded body - implicit length, elements delimited by [LF]
1 element - fixed length of 57, Initiator = ---
1 trailer - implicit length, element delimited by [LF]

All is correct until the parser tries to parse the --- END of record as an unbounded body element. It doesn't seem to recognise the --- initiator so it fails. It also doesn't seem to recognise the [LF] terminator for the --- END record.

How do I get the parser to see the --- END record as the new element and not another unbounded body element?

TIA
Back to top
View user's profile Send private message
timber
PostPosted: Sat Nov 20, 2021 8:33 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Please supply
* (the relevant parts of) your DFDL xsd
* the DFDL trace that the toolkit outputs when trying to parse your input document

...and please put each item in its own [c o d e] block, to preserve the indentation and keep it readable.
Back to top
View user's profile Send private message
petervh1
PostPosted: Sun Nov 21, 2021 11:15 pm    Post subject: Reply with quote

Centurion

Joined: 19 Apr 2010
Posts: 122

Here's the XSD:
Code:

<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ibmDfdlExtn="http://www.ibm.com/dfdl/extensions" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:recFixLengthFieldsFmt="http://www.ibm.com/dfdl/RecordFixLengthFieldFormat">

    <xsd:import namespace="http://www.ibm.com/dfdl/RecordFixLengthFieldFormat" schemaLocation="IBMdefined/RecordFixLengthFieldFormat.xsd"/>
    <xsd:annotation>
      <xsd:appinfo source="http://www.ogf.org/dfdl/">
         <dfdl:format encoding="US-ASCII" escapeSchemeRef="" occursCountKind="fixed" ref="recFixLengthFieldsFmt:RecordFixLengthFieldsFormat"/>
      </xsd:appinfo>
   </xsd:annotation>

   <xsd:element dfdl:lengthKind="delimited" ibmSchExtn:docRoot="true" name="xw65mad">
      <xsd:complexType>
         <xsd:sequence dfdl:separator="%NL;%WSP*;" dfdl:separatorSuppressionPolicy="anyEmpty">
            <xsd:element dfdl:lengthKind="delimited" dfdl:occursCountKind="implicit" maxOccurs="unbounded" name="body">
               <xsd:complexType>
                  <xsd:sequence>
                     <xsd:element dfdl:lengthKind="implicit" dfdl:outputNewLine="%LF;" dfdl:textStringPadCharacter="%SP;" ibmDfdlExtn:sampleValue="body_valu1" name="body_elem1">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="57"/>
                    <xsd:minLength value="57"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
                                              <xsd:element dfdl:lengthKind="implicit" dfdl:occursCountKind="implicit" dfdl:outputNewLine="%LF;" dfdl:textStringPadCharacter="%SP;" maxOccurs="unbounded" minOccurs="0" name="field1">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="64"/>
                    <xsd:maxLength value="64"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
                            <xsd:element dfdl:initiator="" dfdl:length="57" dfdl:lengthKind="explicit" dfdl:outputNewLine="%LF;" dfdl:terminator="%LF;" name="field2">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="57"/>
                    <xsd:maxLength value="57"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
                            <xsd:element dfdl:lengthKind="implicit" dfdl:outputNewLine="%LF;" name="field3">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:minLength value="11"/>
                    <xsd:maxLength value="11"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
                        </xsd:sequence>
               </xsd:complexType>
            </xsd:element>
                                                 </xsd:sequence>
      </xsd:complexType>
   </xsd:element>


</xsd:schema>


Here's the DFDL trace:
Code:



********************* DFDL Parser Setup Starting *********************
Schema = /XW65_Transformation/xw65mad.xsd
**********************************************************************



********************* DFDL Parser Starting *********************
Data = C:\Shoprite\XW65_Transformation\xw65mad20211116(SUBSET).txt
Message = xw65mad (/XW65_Transformation/xw65mad.xsd)
****************************************************************

22 Nov 2021, 9:10:48 AM   info: Offset: 0. Parsing will start from root element 'xw65mad'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad), 66]

22 Nov 2021, 9:10:48 AM   info: The default value of '%LF;' was assigned to variable 'outputNewLine' in namespace 'http://www.ogf.org/dfdl/dfdl-1.0/'.       
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = , 133]

22 Nov 2021, 9:10:48 AM   info: Offset: 0. Starting to process element 'xw65mad'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad), 57]

22 Nov 2021, 9:10:48 AM   info: Offset: 0. Up to 'unbounded' occurrences of element 'body' will be expected because occursCountKind='implicit' and maxOccurs='unbounded'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body), 145]

22 Nov 2021, 9:10:48 AM   info: Offset: 0. Starting to process element 'body'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body), 54]

22 Nov 2021, 9:10:48 AM   info: Offset: 0. Starting to process element 'body_elem1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 60]

22 Nov 2021, 9:10:48 AM   info: Offset: 0. Found specified length value '*** START OF /dcs/outbound/Branch/AU03027DOS40476004796 %LF;' for element 'body_elem1'. The length was 57 bytes.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 162]

22 Nov 2021, 9:10:48 AM   info: Offset: 57. Finished processing element 'body_elem1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 61]

22 Nov 2021, 9:10:48 AM   info: Offset: 57. Up to 'unbounded' occurrences of element 'field1' will be expected because occursCountKind='implicit' and maxOccurs='unbounded'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 148]

22 Nov 2021, 9:10:48 AM   info: Offset: 57. Optional element 'field1' encountered. The DFDL parser will return to this position if the element is not present in the data stream.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 153]

22 Nov 2021, 9:10:48 AM   info: Offset: 57. Starting to process element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 57]

22 Nov 2021, 9:10:48 AM   info: Offset: 57. Found specified length value '101011891084080939202109240000010O00000003027                  %LF;' for element 'field1'. The length was 64 bytes.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 166]

22 Nov 2021, 9:10:48 AM   info: Offset: 121. Finished processing element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 58]

22 Nov 2021, 9:10:48 AM   info: Offset: 121. Optional element 'field1' encountered. The DFDL parser will return to this position if the element is not present in the data stream.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 154]

22 Nov 2021, 9:10:48 AM   info: Offset: 121. Starting to process element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 58]

22 Nov 2021, 9:10:48 AM   info: Offset: 121. Found specified length value '101011891086426358202110270000010O00000003027                  %LF;' for element 'field1'. The length was 64 bytes.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 167]

22 Nov 2021, 9:10:48 AM   info: Offset: 185. Finished processing element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 58]

22 Nov 2021, 9:10:48 AM   info: Offset: 185. Optional element 'field1' encountered. The DFDL parser will return to this position if the element is not present in the data stream.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 154]

22 Nov 2021, 9:10:48 AM   info: Offset: 185. Starting to process element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 58]

22 Nov 2021, 9:10:48 AM   info: Offset: 185. Found specified length value '107686771087434801202111110000020D09470319083                  %LF;' for element 'field1'. The length was 64 bytes.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 167]

22 Nov 2021, 9:10:48 AM   info: Offset: 249. Finished processing element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 58]

22 Nov 2021, 9:10:48 AM   info: Offset: 249. Optional element 'field1' encountered. The DFDL parser will return to this position if the element is not present in the data stream.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 154]

22 Nov 2021, 9:10:48 AM   info: Offset: 249. Starting to process element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 58]

22 Nov 2021, 9:10:48 AM   info: Offset: 249. Found specified length value '107689681087866892202111160000001O00000009083                  %LF;' for element 'field1'. The length was 64 bytes.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 167]

22 Nov 2021, 9:10:48 AM   info: Offset: 313. Finished processing element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 58]

22 Nov 2021, 9:10:48 AM   info: Offset: 313. Optional element 'field1' encountered. The DFDL parser will return to this position if the element is not present in the data stream.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 154]

22 Nov 2021, 9:10:48 AM   info: Offset: 313. Starting to process element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 58]

22 Nov 2021, 9:10:48 AM   info: Offset: 313. Found specified length value '--- END   OF /dcs/outbound/Branch/AU09083DOS40476004796 %LF;Z300154' for element 'field1'. The length was 64 bytes.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 167]

22 Nov 2021, 9:10:48 AM   info: Offset: 377. Finished processing element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 58]

22 Nov 2021, 9:10:48 AM   info: Offset: 377. Optional element 'field1' encountered. The DFDL parser will return to this position if the element is not present in the data stream.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 154]

22 Nov 2021, 9:10:48 AM   info: Offset: 377. Starting to process element 'field1'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 58]

22 Nov 2021, 9:10:48 AM   error: CTDP3000E: Unexpected end of data at byte offset '381' while parsing element '#xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1)'. The parser encountered the end of the data stream or the end of a parent element.

22 Nov 2021, 9:10:48 AM   info: Offset: 381. Parser was unable to resolve data on the current branch and will evaluate the next available branch beginning at offset '377' owned by the 'sequence' group contained within element 'body'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence), 209]

22 Nov 2021, 9:10:48 AM   info: Offset: 377. Occurrence '6' of element 'field1' was not found in the data. occursCountKind is 'implicit' so no more occurrences of this element will be expected.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field1), 170]

22 Nov 2021, 9:10:48 AM   info: Offset: 377. Starting to process element 'field2'.
                          [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field2), 58]

22 Nov 2021, 9:10:48 AM   error: CTDP3000E: Unexpected end of data at byte offset '381' while parsing element '#xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field2)'. The parser encountered the end of the data stream or the end of a parent element.

22 Nov 2021, 9:10:48 AM   fatal: CTDP3000E: Unexpected end of data at byte offset '381' while parsing element '#xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::field2)'. The parser encountered the end of the data stream or the end of a parent element.

Back to top
View user's profile Send private message
petervh1
PostPosted: Mon Nov 22, 2021 6:41 am    Post subject: Reply with quote

Centurion

Joined: 19 Apr 2010
Posts: 122

Additional comment:

I've read the article at
Quote:

https://community.ibm.com/community/user/integration/viewdocument/what-is-direct-dispatch-and-how-do?CommunityKey=77544459-9fda-40da-ae0b-fc8c76f0ce18&tab=librarydocuments


regarding Direct Dispatch to resolve choice groups. Unfortunately the example in the article uses a field in the message header as the 'discriminator'. Is there some way I can set up the dfdl:choiceDispatchKey to be the length of the records between which a CHOICE must be made?

Just a thought...
Back to top
View user's profile Send private message
timber
PostPosted: Tue Nov 23, 2021 1:06 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

You need to put yourself in the position of the parser. It does not know how many times 'body' will occur. It will keep on parsing 'body' until it encounters a processing error while parsing it. Then it will try the next thing in the schema.

The simplest solution is to add a DFDL discriminator to 'body', and assert that it does not start with '--- END OF'.
Back to top
View user's profile Send private message
petervh1
PostPosted: Tue Nov 23, 2021 5:01 am    Post subject: Reply with quote

Centurion

Joined: 19 Apr 2010
Posts: 122

I added a DFDL discriminator. The parser now at least recognises body_elem2 and parses the data correctly. However, this only works if body_elem1 is set to maxOccurs=1. If I set body_elem1 to unbounded (which is what I need) it fails to recognise body_elem2.

This is the data I am trying to parse:
Code:

*** START OF /dcs/outbound/Branch/AU03027DOS40476004796 [LF]
107689681087866892202111160000001O00000009083        [LF]         
107689681087866892202111160000001O00000009084        [LF]       
--- END   OF /dcs/outbound/Branch/AU09083DOS40476004796 [LF]
Z300154851


This is my XSD:
Code:

<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ibmDfdlExtn="http://www.ibm.com/dfdl/extensions" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:recFixLengthFieldsFmt="http://www.ibm.com/dfdl/RecordFixLengthFieldFormat">

    <xsd:import namespace="http://www.ibm.com/dfdl/RecordFixLengthFieldFormat" schemaLocation="IBMdefined/RecordFixLengthFieldFormat.xsd"/>
    <xsd:annotation>
      <xsd:appinfo source="http://www.ogf.org/dfdl/">
         <dfdl:format encoding="{$dfdl:encoding}" escapeSchemeRef="" occursCountKind="fixed" ref="recFixLengthFieldsFmt:RecordFixLengthFieldsFormat"/>
      </xsd:appinfo>
   </xsd:annotation>

   <xsd:element dfdl:lengthKind="delimited" ibmSchExtn:docRoot="true" name="xw65mad">
      <xsd:complexType>
         <xsd:sequence dfdl:separator="%LF;" dfdl:separatorSuppressionPolicy="anyEmpty">
            <xsd:element dfdl:lengthKind="delimited" name="header">
               <xsd:complexType>
                  <xsd:sequence>
                     <xsd:element dfdl:length="56" dfdl:outputNewLine="{}" ibmDfdlExtn:sampleValue="head_valu1" name="head_elem1" type="xsd:string"/>
                  </xsd:sequence>
               </xsd:complexType>
            </xsd:element>
            <xsd:element dfdl:lengthKind="delimited" name="body">
               <xsd:complexType>
                  <xsd:sequence dfdl:outputNewLine="%LF;">
                     <xsd:element dfdl:lengthKind="implicit" dfdl:lengthUnits="characters" dfdl:occursCountKind="implicit" dfdl:outputNewLine="%LF;" ibmDfdlExtn:sampleValue="body_valu1" maxOccurs="unbounded" name="body_elem1">
                <xsd:annotation>
                  <xsd:appinfo source="http://www.ogf.org/dfdl/">
                    <dfdl:discriminator>{/xw65mad/body/body_elem1 ne '--- END'}</dfdl:discriminator>
                  </xsd:appinfo>
                </xsd:annotation>
                  <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="64"/>
                    <xsd:minLength value="64"/>
                  </xsd:restriction>
                </xsd:simpleType>
                            </xsd:element>
                        <xsd:element dfdl:lengthKind="implicit" dfdl:lengthUnits="characters" dfdl:outputNewLine="%LF;" name="body_elem2">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="57"/>
                    <xsd:minLength value="57"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
                        </xsd:sequence>
               </xsd:complexType>
            </xsd:element>
            <xsd:element dfdl:lengthKind="delimited" name="trailer">
               <xsd:complexType>
                  <xsd:sequence>
                     <xsd:element dfdl:length="10" dfdl:outputNewLine="%LF;" ibmDfdlExtn:sampleValue="trailer_valu1" name="trailer_elem1" type="xsd:string"/>
                  </xsd:sequence>
               </xsd:complexType>
            </xsd:element>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>


</xsd:schema>


This is the DFDL trace:
Code:



********************* DFDL Parser Setup Starting *********************
Schema = /XW65_Transformation/xw65mad.xsd
**********************************************************************



********************* DFDL Parser Starting *********************
Data = C:\Shoprite\XW65_Transformation\new 2.txt
Message = xw65mad (/XW65_Transformation/xw65mad.xsd)
****************************************************************

23 Nov 2021, 2:45:44 PM   info: Offset: 0. Parsing will start from root element 'xw65mad'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad), 66]

23 Nov 2021, 2:45:44 PM   info: The default value of '%LF;' was assigned to variable 'outputNewLine' in namespace 'http://www.ogf.org/dfdl/dfdl-1.0/'.       
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = , 133]

23 Nov 2021, 2:45:44 PM   info: Offset: 0. Starting to process element 'xw65mad'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad), 57]

23 Nov 2021, 2:45:44 PM   info: Offset: 0. Starting to process element 'header'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::header), 56]

23 Nov 2021, 2:45:44 PM   info: Offset: 0. Starting to process element 'head_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::header/type::0/model::sequence/schemaElement::head_elem1), 60]

23 Nov 2021, 2:45:44 PM   info: Offset: 0. Found specified length value '*** START OF /dcs/outbound/Branch/AU03027DOS40476004796' for element 'head_elem1'. The length was 56 bytes.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::header/type::0/model::sequence/schemaElement::head_elem1), 157]

23 Nov 2021, 2:45:44 PM   info: Offset: 56. Finished processing element 'head_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::header/type::0/model::sequence/schemaElement::head_elem1), 61]

23 Nov 2021, 2:45:44 PM   info: Offset: 56. Finished processing element 'header'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::header), 57]

23 Nov 2021, 2:45:44 PM   info: Offset: 56. Found separator '%LF;' owned by the 'sequence' group contained within element 'xw65mad'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence), 108]

23 Nov 2021, 2:45:44 PM   info: Offset: 57. Starting to process element 'body'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body), 55]

23 Nov 2021, 2:45:44 PM   info: Offset: 57. Up to 'unbounded' occurrences of element 'body_elem1' will be expected because occursCountKind='implicit' and maxOccurs='unbounded'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 152]

23 Nov 2021, 2:45:44 PM   info: Offset: 57. Starting to process element 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 61]

23 Nov 2021, 2:45:44 PM   info: Offset: 57. Attempting expression '{/xw65mad/body/body_elem1 ne '--- END'}' for element 'body_elem1'.

23 Nov 2021, 2:45:44 PM   info: CTDV1551E : DFDL expression '{/xw65mad/body/body_elem1 ne '--- END'}' cannot be evaluated because the info set does not contain any elements matching the path reference '/xw65mad/body/body_elem1'.   

23 Nov 2021, 2:45:44 PM   info: Offset: 57. Could not evaluate expression '{/xw65mad/body/body_elem1 ne '--- END'}' for element 'body_elem1' as one or more inputs have not yet been parsed.

23 Nov 2021, 2:45:44 PM   info: Offset: 57. Found specified length value '107689681087866892202111160000001O00000009083                  %LF;' for element 'body_elem1'. The length was 64 bytes.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 170]

23 Nov 2021, 2:45:44 PM   info: Offset: 121. Finished processing element 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 62]

23 Nov 2021, 2:45:44 PM   info: Offset: 57. Attempting expression '{/xw65mad/body/body_elem1 ne '--- END'}' for element 'body_elem1'.

23 Nov 2021, 2:45:44 PM   info: Offset: 57. A DFDL discriminator with condition '{/xw65mad/body/body_elem1 ne '--- END'}' evaluated to true while parsing 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 143]

23 Nov 2021, 2:45:44 PM   info: Offset: 121. Optional element 'body_elem1' encountered. The DFDL parser will return to this position if the element is not present in the data stream.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 158]

23 Nov 2021, 2:45:44 PM   info: Offset: 121. Starting to process element 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 62]

23 Nov 2021, 2:45:44 PM   info: Offset: 121. Attempting expression '{/xw65mad/body/body_elem1 ne '--- END'}' for element 'body_elem1'.

23 Nov 2021, 2:45:44 PM   info: Offset: 121. A DFDL discriminator with condition '{/xw65mad/body/body_elem1 ne '--- END'}' evaluated to true while parsing 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 144]

23 Nov 2021, 2:45:44 PM   info: Offset: 121. Found specified length value '107689681087866892202111160000001O00000009084                  %LF;' for element 'body_elem1'. The length was 64 bytes.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 171]

23 Nov 2021, 2:45:44 PM   info: Offset: 185. Finished processing element 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 62]

23 Nov 2021, 2:45:44 PM   info: Offset: 185. Optional element 'body_elem1' encountered. The DFDL parser will return to this position if the element is not present in the data stream.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 158]

23 Nov 2021, 2:45:44 PM   info: Offset: 185. Starting to process element 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 62]

23 Nov 2021, 2:45:44 PM   info: Offset: 185. Attempting expression '{/xw65mad/body/body_elem1 ne '--- END'}' for element 'body_elem1'.

23 Nov 2021, 2:45:44 PM   info: Offset: 185. A DFDL discriminator with condition '{/xw65mad/body/body_elem1 ne '--- END'}' evaluated to true while parsing 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 144]

23 Nov 2021, 2:45:44 PM   info: Offset: 185. Found specified length value '--- END   OF /dcs/outbound/Branch/AU09083DOS40476004796 %LF;Z300154' for element 'body_elem1'. The length was 64 bytes.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 171]

23 Nov 2021, 2:45:44 PM   info: Offset: 249. Finished processing element 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 62]

23 Nov 2021, 2:45:44 PM   info: Offset: 249. Optional element 'body_elem1' encountered. The DFDL parser will return to this position if the element is not present in the data stream.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 158]

23 Nov 2021, 2:45:44 PM   info: Offset: 249. Starting to process element 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 62]

23 Nov 2021, 2:45:44 PM   info: Offset: 249. Attempting expression '{/xw65mad/body/body_elem1 ne '--- END'}' for element 'body_elem1'.

23 Nov 2021, 2:45:44 PM   info: Offset: 249. A DFDL discriminator with condition '{/xw65mad/body/body_elem1 ne '--- END'}' evaluated to true while parsing 'body_elem1'.
                           [dfdl = /XW65_Transformation/xw65mad.xsd, scd = #xscd(/schemaElement::xw65mad/type::0/model::sequence/schemaElement::body/type::0/model::sequence/schemaElement::body_elem1), 144]

23 Nov 2021, 2:45:44 PM   error: CTDP3000E: Unexpected end of data at byte offset '253' while parsing element 'body_elem1'. The parser encountered the end of the data stream or the end of a parent element.

23 Nov 2021, 2:45:44 PM   fatal: CTDP3000E: Unexpected end of data at byte offset '253' while parsing element 'body_elem1'. The parser encountered the end of the data stream or the end of a parent element.



As you can see, the parser tries to allocate 64 bytes to the "--- END OF" record, when it should be only 57 bytes.

Thanks for your help so far.
Back to top
View user's profile Send private message
timber
PostPosted: Tue Nov 23, 2021 8:28 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

I'm confused. Your original description of the structure was:
Code:

1 header - implicit length, element delimited by [LF]
Unbounded body - implicit length, elements delimited by [LF]
1 element - fixed length of 57, Initiator = ---
1 trailer - implicit length, element delimited by [LF]


...but your XSD is written thus:
Code:

1 header - implicit length, element delimited by [LF]
1 body - implicit length, elements delimited by [LF]
    Unbounded body_elem1
    1 body_elem2 - fixed length of 57, Initiator = ---
1 trailer - implicit length, element delimited by [LF]


So...is body_elem2
a) the second half of a two-part repeating body element (as you claimed in your initial question) or
b) is it the first half of a 2-part trailer for the entire document?
Back to top
View user's profile Send private message
petervh1
PostPosted: Tue Nov 23, 2021 9:06 am    Post subject: Reply with quote

Centurion

Joined: 19 Apr 2010
Posts: 122

Apologies. You are, of course, quite right. I have been trying various permutations to get the discriminator right.

The structure should be:
Code:

1 header - fixed length of 57 [LF]
Unbounded body - implicit length, elements delimited by [LF]
1 element - fixed length of 57, first 7 bytes of the record are "--- END' [LF]
1 trailer - fixed length of 10 [LF]


The only record that can repeat is the one of this nature:
Code:

101011891084080939202109240000010O00000003027 [LF]
Back to top
View user's profile Send private message
timber
PostPosted: Wed Nov 24, 2021 3:20 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Thanks - that makes sense now.

Your discriminator is wrong - it needs to distinguish between your unbounded body element and the thing that can follow it. Currently, you are checking for '--- END' but that record cannot follow the repeating element. I think you need to
- rename body_elem2. The name is very confusing because this is actually part of the trailer.
- Change the discriminator on body_elem1. It needs to check for does not start with '--- END'. Currently you are checking for does not equal.
Back to top
View user's profile Send private message
petervh1
PostPosted: Thu Nov 25, 2021 4:54 am    Post subject: Reply with quote

Centurion

Joined: 19 Apr 2010
Posts: 122

Thanks again for your help - I got it working.

I couldn't find a way to use a fn to check does not start with, so I used:
Code:

<dfdl:discriminator>{fn:contains (.  ,'      ' )}</dfdl:discriminator>


which works fine for this data.
Back to top
View user's profile Send private message
timber
PostPosted: Fri Nov 26, 2021 9:09 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

DFDL supports the XPath starts-with() function, as documented here: http://daffodil.apache.org/docs/dfdl/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » DFDL parser initiator issue
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.