Author |
Message
|
saurabh867 |
Posted: Wed Sep 28, 2011 11:07 pm Post subject: Message Set Parsing |
|
|
Voyager
Joined: 13 Jun 2010 Posts: 78
|
Hi,
I have created a message set such that :
Code: |
Message (1..1 ) (all Elements Delimited - Delimiter <CR><LF>)
Child1 (0...1)(Fixed Length)
element1
element2
Child2
element1
.
.
Child3
.
. |
So all my child elements are separated by newline character and the elements inside the child are fixed length.
When I create a simple output message for this structure, it creates extra new line characters between each of this child elements.
Please tell me what could be possibly wrong here.
Code: |
ET OutputRoot.MRM.E1P0000.PA='123456';
SET OutputRoot.MRM.E1P0000.PERSONID_EXT='12';
SET OutputRoot.MRM.E1P0000.BEGDA='12345678';
SET OutputRoot.MRM.E1P0000.MASSN='12';
SET OutputRoot.MRM.E1P0000.MASSG='12';
SET OutputRoot.MRM.E1P0000.STAT2='1';
SET OutputRoot.MRM.E1P0041.PA='45';
SET OutputRoot.MRM.E1P0041.PERSONID_EXT='45';[quote]
This is what I am writing in my esql. E1P000 and E1p0041 are child elements which I referred in the message set above.[/quote] |
|
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 29, 2011 1:27 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You need to set Data Element Separation to 'Fixed Length' on the inner complex types.
Not sure why you posted your ESQL. The ESQL ( or mapping node, or Java, or PHP ) will only modify the logical message tree. The contents of the message tree cannot affect the delimiters in your output physical format. That is what the physical format in the message set is for.
Now, if you had posted details of your TDS settings ( i.e. the physical format settings ) then that would have been useful. |
|
Back to top |
|
 |
saurabh867 |
Posted: Thu Sep 29, 2011 1:35 am Post subject: |
|
|
Voyager
Joined: 13 Jun 2010 Posts: 78
|
Hi,
Yes I had set Data element separation for inner complex type as Fixed Length.
Suppress Absent Element Delimiter is End of Type. The issue is coming when I set a child element other than the first one, so the output carries the delimiter as newline for the first one.
Do we have any option to to remove delimiters of absent elements (I believe END OF TYPE only removes the delimiter from the end.)
Regards,
Saurabh |
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 29, 2011 2:03 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Please describe your data format in more detail. Are child1, child2 and child3 alternatives ( i.e. members of a choice ) or just optional members of a sequence? |
|
Back to top |
|
 |
saurabh867 |
Posted: Thu Sep 29, 2011 2:58 am Post subject: |
|
|
Voyager
Joined: 13 Jun 2010 Posts: 78
|
Hi,
This is how the definition file looks like.
Code: |
<xsd:element name="PERSON" type="PERSON1">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<MRMessage messageDefinition="/0/PERSON;XSDElementDeclaration=61$MRObject"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:complexType name="PERSON1">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsStructRep dataElementSeparation="AllElementsDelimited" delimiter="<CR><LF>" messageSetDefaultRep="Text1"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="localElement" nillable="false" type="PERSONTYPE"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PERSONTYPE">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsStructRep dataElementSeparation="AllElementsDelimited" delimiter="<CR><LF>" messageSetDefaultRep="Text1" suppressAbsentElementDelimiters="EndOfType"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:element minOccurs="0" name="E1P0000" type="E1P0000">
</xsd:element>
<xsd:element minOccurs="0" name="E1P0001" nillable="true" type="E1P0001">
</xsd:element>
<xsd:element minOccurs="0" name="E1P0002" nillable="true" type="E1P0002">
</xsd:element> |
The issue here is when I set some values inside E1P0001 alone and do not set anything for E1P0000, the output has a line feed before E1P0001 . |
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 29, 2011 4:02 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
If delimiters are suppressed then please describe, in detail, how the parser can work out whether the first delimited field is an E1P0000 or an E1P0001 or an E1P0002.
I suspect that you need to remove the delimiter and set a Group Terminator on the complex types of E1P0000 /E1P00001/E1P00002. |
|
Back to top |
|
 |
saurabh867 |
Posted: Thu Sep 29, 2011 4:22 am Post subject: |
|
|
Voyager
Joined: 13 Jun 2010 Posts: 78
|
I got your point. The parser would need the delimiters to identify the elements.
But in my case only one of these E1P0000 or E1P0001 can be present. In this case what would you suggest the property of Data Element Separation and Group Terminator.
Thanks for quick response on this.
Regards,
Saurabh |
|
Back to top |
|
 |
saurabh867 |
Posted: Thu Sep 29, 2011 4:44 am Post subject: |
|
|
Voyager
Joined: 13 Jun 2010 Posts: 78
|
Hi Kimbert,
I tried my self and got it resolved. Now it looks like this: (Some part of the message definition file.)
Code: |
<xsd:element name="PERSON" type="PERSON">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<MRMessage messageDefinition="/0/PERSON;XSDElementDeclaration=61$MRObject"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:complexType name="PERSON">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsStructRep dataElementSeparation="AllElementsDelimited" delimiter="<CR><LF>" messageSetDefaultRep="Text1"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="RECORD" nillable="false" type="PERSONTYPE"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PERSONTYPE">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsStructRep dataElementSeparation="UseDataPattern" delimiter="<CR><LF>" groupTerminator="" messageSetDefaultRep="Text1" suppressAbsentElementDelimiters="EndOfType"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:element minOccurs="0" name="E1P0000" nillable="true" type="E1P0000">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep dataPattern="PA0000" messageSetDefaultRep="Text1" precision="-1"/>
<tdsInclRep dataPattern="PA0000" messageSetDefaultRep="Text1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="E1P0001" nillable="true" type="E1P0001">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep dataPattern="PA0001" messageSetDefaultRep="Text1" precision="-1"/>
<tdsInclRep dataPattern="PA0001" messageSetDefaultRep="Text1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType> |
Thanks for your timely help and pointers. It turned out to be pretty simple now.
Regards,
Saurabh |
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 29, 2011 6:41 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
That doesn't look right to me. Hopefully I'm misreading your mxsd file, but post again if/when you find problems while unit testing this message set. |
|
Back to top |
|
 |
saurabh867 |
Posted: Thu Sep 29, 2011 8:58 pm Post subject: |
|
|
Voyager
Joined: 13 Jun 2010 Posts: 78
|
Ok,
Can you tell me the area where you feel, there might be problem. I also did a Unit test for a small set of test data and it went fine.
But I would like to know for my knowledge what should be corrected here and study about that.
Regards,
Saurabh |
|
Back to top |
|
 |
kimbert |
Posted: Fri Sep 30, 2011 4:39 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
If you use a data pattern, then that data pattern must match the entire group or element on which it is defined. In other words, if the data pattern 'PA0000' on element E1P0000 matches 6 characters, then there will only be 6 characters available for the entire scope of element E1P0000.
I'm guessing that you don't want that - you want the 'PA0000' to be matched as as tag for the remainder of the element. |
|
Back to top |
|
 |
|