Author |
Message
|
nelson |
Posted: Fri May 08, 2015 5:34 am Post subject: DFDL terminator issue |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
Hi all,
Working on IIB 9.0.0.2.
I have the following input message:
Code: |
HEADERFIELD1|HEADERFIELD2|HEADERFIELD3|BODYFIELD1|BODYFIELD2|BODYFIELD3|//BODYFIELD1|BODYFIELD2|BODYFIELD3|//\MSGEND |
I have complex types defined this way:
Code: |
<xsd:complexType name="t_Header">
<xsd:sequence dfdl:separator="|" dfdl:separatorPosition="postfix">
<xsd:element name="HEADERFIELD1" type="xsd:string"/>
<xsd:element name="HEADERFIELD2" type="xsd:string"/>
<xsd:element name="HEADERFIELD3" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<?xml version="1.0" encoding="UTF-8"?>
<xsd:complexType name="t_MSG">
<xsd:sequence dfdl:separator="" dfdl:terminator="\MSGEND">
<xsd:element dfdl:initiator="" dfdl:terminator=""
name="ResponseHeader" type="t_Header"/>
<xsd:element dfdl:initiator="" dfdl:occursCountKind="implicit"
dfdl:terminator="" maxOccurs="unbounded" name="bodypart">
<xsd:complexType>
<xsd:sequence dfdl:initiator="" dfdl:separator="|"
dfdl:separatorPosition="postfix" dfdl:terminator="//">
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:sequence/>
</xsd:appinfo>
</xsd:annotation>
<xsd:element default="" name="FIELD1" type="xsd:string"/>
<xsd:element default="" name="FIELD2" type="xsd:string"/>
<xsd:element default="" name="FIELD3" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
|
And a message defined this way:
Code: |
<xsd:element ibmSchExtn:docRoot="true" name="MSG" type="t_MSG"/> |
But getting this error:
Code: |
May 8, 2015, 9:20:44 AM info: Offset: 505. Optional element 'bodypart' encountered. The DFDL parser will return to this position if the element is not present in the data stream.
[dfdl = /yyy/model/yyy.xsd, scd = #xscd(/type::t_MSG/model::sequence/schemaElement::), 155]
May 8, 2015, 9:20:44 AM info: Offset: 505. Starting to process element 'bodypart'.
[dfdl = /yyy/model/yyy.xsd, scd = #xscd(/type::t_MSG/model::sequence/schemaElement::bodypart), 59]
May 8, 2015, 9:20:44 AM info: Offset: 505. Starting to process element 'FIELD1'.
[dfdl = /yyy/model/yyy.xsd, scd = #xscd(/type::t_MSG/model::sequence/schemaElement::bodypart/type::0/model::sequence/schemaElement::FIELD1), 60]
May 8, 2015, 9:20:44 AM info: Offset: 505. Element 'FIELD1' is empty because the content region is empty.
[dfdl = /yyy/model/yyy.xsd, scd = #xscd(/type::t_MSG/model::sequence/schemaElement::bodypart/type::0/model::sequence/schemaElement::FIELD1), 85]
May 8, 2015, 9:20:44 AM info: Offset: 505. Found delimited value: '' for element 'FIELD1'. The delimiter was '\MSGEND'.
[dfdl = /yyy/model/yyy.xsd, scd = #xscd(/type::t_MSG/model::sequence/schemaElement::bodypart/type::0/model::sequence/schemaElement::FIELD1), 100]
May 8, 2015, 9:20:44 AM fatal: CTDP3108E: When parsing, the IBM DFDL processor does not support an empty or missing element with a default value. |
Please do not take care of the offsets, the original message is very large and has a lot of fields .. I wanted to simplify my question.
I don't understand why the parser is not recognizing the main sequence terminator and staring a parsing a new bodypart compley type.
Any hint on this issue is very appreciated.
Last edited by nelson on Fri May 08, 2015 5:52 am; edited 1 time in total |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri May 08, 2015 5:40 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You defined a field separator as '|'. But it looks more like what you actually have is a field terminator as '|'. Your group separator should be fine.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Fri May 08, 2015 5:45 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I am hoping that you mangled that DFDL schema when you tried to simplify it...
You seem to be missing an </xsd:sequence>.
Also, the indentation makes it a bit hard to tell what parts of the body are in what sections.
The error in question seems to be saying that it's finding an empty value for FIELD1, and you haven't specified that the field can be nillable.
You might try creating a copy of the msg definition, that is simplified down to only the parts you are showing and then test it out and refine it until it works. Then you can modify the original DFDL to match the working one. |
|
Back to top |
|
 |
nelson |
Posted: Fri May 08, 2015 5:46 am Post subject: |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
fjb_saper wrote: |
You defined a field separator as '|'. But it looks more like what you actually have is a field terminator as '|'. Your group separator should be fine.
Have fun  |
I defined a '|' as a separator, but dfdl:separatorPosition="postfix", so I think this is ok, should be recognized as a postfix separator? |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri May 08, 2015 5:51 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
nelson wrote: |
fjb_saper wrote: |
You defined a field separator as '|'. But it looks more like what you actually have is a field terminator as '|'. Your group separator should be fine.
Have fun  |
I defined a '|' as a separator, but dfdl:separatorPosition="postfix", so I think this is ok, should be recognized as a postfix separator? |
I would not expect a separator to show up after the last field... however I would expect a terminator to do so... I am sure Kimbert or mqjeff will correct me if I'm wrong here...  _________________ MQ & Broker admin
Last edited by fjb_saper on Fri May 08, 2015 6:04 am; edited 1 time in total |
|
Back to top |
|
 |
nelson |
Posted: Fri May 08, 2015 6:00 am Post subject: |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
mqjeff wrote: |
I am hoping that you mangled that DFDL schema when you tried to simplify it...
You seem to be missing an </xsd:sequence>.
Also, the indentation makes it a bit hard to tell what parts of the body are in what sections.
The error in question seems to be saying that it's finding an empty value for FIELD1, and you haven't specified that the field can be nillable.
You might try creating a copy of the msg definition, that is simplified down to only the parts you are showing and then test it out and refine it until it works. Then you can modify the original DFDL to match the working one. |
Thanks mqjeff, corrected the XML.
What I don't understand is why the parser is starting to parse a new bodypart element, I expected the upper level terminator to be recognized... |
|
Back to top |
|
 |
nelson |
Posted: Fri May 08, 2015 6:05 am Post subject: |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
fjb_saper wrote: |
nelson wrote: |
fjb_saper wrote: |
You defined a field separator as '|'. But it looks more like what you actually have is a field terminator as '|'. Your group separator should be fine.
Have fun  |
I defined a '|' as a separator, but dfdl:separatorPosition="postfix", so I think this is ok, should be recognized as a postfix separator? |
I would not expect a separator to show up after the last field... however I would expect a terminator to do so... I am sure Kimbert will correct me if I'm wrong here...  |
As you can see the bodypart is:
Code: |
PART1|PART2|PART3|// |
So I defined the terminator as "//" and "|" as the separator (postfix).
I have also tried putting "|//" as a bodypart terminator, and "|" as a separator (infix), but getting the same error. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri May 08, 2015 6:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Make it more simple and easier to read: Extract the complex type from the message and define on its own...
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<!-- all dfdl import statements here -->
<xsd:complexType name="t_MSG">
<xsd:sequence dfdl:separator="" dfdl:terminator="\MSGEND">
<xsd:element dfdl:initiator="" dfdl:terminator="" name="ResponseHeader" type="t_Header"/>
<xsd:element dfdl:initiator="" dfdl:occursCountKind="implicit" dfdl:terminator="" maxOccurs="unbounded" name="bodypart"
type="BodyPartType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="t_Header">
<xsd:sequence dfdl:separator="|" dfdl:separatorPosition="postfix">
<xsd:element name="HEADERFIELD1" type="xsd:string"/>
<xsd:element name="HEADERFIELD2" type="xsd:string"/>
<xsd:element name="HEADERFIELD3" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name "BodyPartType">
<xsd:sequence dfdl:initiator="" dfdl:separator="|" dfdl:separatorPosition="postfix" dfdl:terminator="//">
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/"/>
</xsd:annotation>
<xsd:element default="" name="FIELD1" type="xsd:string"/>
<xsd:element default="" name="FIELD2" type="xsd:string"/>
<xsd:element default="" name="FIELD3" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
|
Why define the body part in the message and not like the header?
It makes the dfdl much more difficult to read... _________________ MQ & Broker admin |
|
Back to top |
|
 |
nelson |
Posted: Fri May 08, 2015 7:09 am Post subject: |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
fjb_saper wrote: |
Make it more simple and easier to read: Extract the complex type from the message and define on its own...
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<!-- all dfdl import statements here -->
<xsd:complexType name="t_MSG">
<xsd:sequence dfdl:separator="" dfdl:terminator="\MSGEND">
<xsd:element dfdl:initiator="" dfdl:terminator="" name="ResponseHeader" type="t_Header"/>
<xsd:element dfdl:initiator="" dfdl:occursCountKind="implicit" dfdl:terminator="" maxOccurs="unbounded" name="bodypart"
type="BodyPartType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="t_Header">
<xsd:sequence dfdl:separator="|" dfdl:separatorPosition="postfix">
<xsd:element name="HEADERFIELD1" type="xsd:string"/>
<xsd:element name="HEADERFIELD2" type="xsd:string"/>
<xsd:element name="HEADERFIELD3" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name "BodyPartType">
<xsd:sequence dfdl:initiator="" dfdl:separator="|" dfdl:separatorPosition="postfix" dfdl:terminator="//">
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/"/>
</xsd:annotation>
<xsd:element default="" name="FIELD1" type="xsd:string"/>
<xsd:element default="" name="FIELD2" type="xsd:string"/>
<xsd:element default="" name="FIELD3" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
|
Why define the body part in the message and not like the header?
It makes the dfdl much more difficult to read... |
Wow, this solved the issue! Very strange, but works!
Thanks a lot for your time. |
|
Back to top |
|
 |
kimbert |
Posted: Sat May 09, 2015 1:57 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Wow, this solved the issue! Very strange, but works! |
Hmmm.
The DFDL parser does not know or care whether a complex type is defined globally or locally. Is it possible that you accidentally changed something else while making the complex types global? _________________ 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 |
|
 |
|