Author |
Message
|
rajkumarv |
Posted: Tue Nov 16, 2010 9:05 pm Post subject: TDS to xml |
|
|
Newbie
Joined: 03 Nov 2010 Posts: 4
|
hi all,
I have a '|' delimited data as input string which i am converting to xml. If i have input like abc||def it gets converted to <first>abc</first>
<third>def</third> , the second element being ignored by the parser since it is null/empty.
How can i convert it to like <first>abc</first><second></second>< third>def</third> for the same input?
I tried what is mentioned in the TDS Null handling options like setting the NULLLiteralValue and nillable ,but it is not working.
Thanks in advance,
Raj |
|
Back to top |
|
 |
kimbert |
Posted: Wed Nov 17, 2010 1:47 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Setting the TDS properties is not enough. You also need to set the logical property 'Nillable'. Have you ticked the 'Nillable' option in the logical properties of the element?
If that doesn't work, please post the relevant snippet of your mxsd file ( and use [code] tags please ). |
|
Back to top |
|
 |
rajkumarv |
Posted: Wed Nov 17, 2010 3:00 am Post subject: |
|
|
Newbie
Joined: 03 Nov 2010 Posts: 4
|
hi kimbert,
I am posting the mxsd relevant portion here. encodingNullValue is given as (Blank) as per the tutorial but i had tried other values also which wasnt working. I had ticked the Nillable option as well.
Code: |
<xsd:complexType name="epcmessage">
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:element name="loginid" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep encodingNull="NullLiteralValue" encodingNullValue="(Blank)" messageSetDefaultRep="GISMessage" precision="-1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="firstname" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep encodingNull="NullLiteralValue" encodingNullValue="(Blank)" length="0" messageSetDefaultRep="GISMessage" precision="-1" render="Characters"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="secondname" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep encodingNull="NullLiteralValue" encodingNullValue="(Blank)" messageSetDefaultRep="GISMessage" precision="-1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
|
Please let me know if you need any further info |
|
Back to top |
|
 |
kimbert |
Posted: Wed Nov 17, 2010 3:45 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I think I may know what the problem is
When it says ' TDS Encoding Null Value = (Blank)' it means that you should set the property to the empty string, not '(Blank)'. I can see how it could be confusing for some readers, though. I will ask for the infocenter to be updated.
So...if you set NullLiteralValue to the empty string it should all start working. Please let us know whether if it works. |
|
Back to top |
|
 |
rajkumarv |
Posted: Thu Nov 18, 2010 8:23 am Post subject: |
|
|
Newbie
Joined: 03 Nov 2010 Posts: 4
|
Exactly..
I got my mistake and yes your were right, I got the wrong idea from the documentation .
It is working as expected.
Thanks Kim |
|
Back to top |
|
 |
jacquesvdm |
Posted: Wed May 09, 2012 9:58 pm Post subject: |
|
|
Apprentice
Joined: 18 Jan 2012 Posts: 29
|
I know this is an old thread but my problem is the same as originally described.
I have configured the message set exactly as described in the infocentre and it still omits empty fields. The field I have listed in the extract below is "status".
This is what have I configured
Nillable = true
TDS Encoding Null = 'NullLiteralValue'
TDS Encoding Null Value = ''
The result in the MRM is NO 'status' field.
suppressAbsentElementDelimiters=Never (I have tried the alternative and the result is the same)
Code: |
<xsd:group name="ET5_Data">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsStructRep messageSetDefaultRep="Text_CSV" suppressAbsentElementDelimiters="Never"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element minOccurs="0" name="Filler" nillable="false" type="xsd:string"/>
<xsd:element default="null" name="DialledNumber" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="Filler1" nillable="false" type="xsd:string"/>
<xsd:element minOccurs="1" name="Status" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep encodingNull="NullLiteralValue" encodingNullValue="''" messageSetDefaultRep="Text_CSV" precision="-1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
|
The data that match the extract is,
Code: |
,,"27111111111",,,,,"122222222222222", |
One of the the four commas in the middle represents the status field. To be more precise , the second comma is the status field.
To make it clear, this how it would have looked with field filled in
Code: |
,,"27111111111",,"Status",,,"122222222222222", |
I am sure there is some hidden flag somewhere that I missed and would be greatfull for any help. |
|
Back to top |
|
 |
kimbert |
Posted: Thu May 10, 2012 1:40 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I have configured the message set exactly as described in the infocentre and it still omits empty fields. |
Before we go any further, where are the fields omitted from? Are you seeing
a) missing tags in your XML output, or
b) missing fields in your message tree?
The settings that you have quoted look correct, so the best advice that I can give is to create another message set for a very simple delimited format ( say, three fields ) as a proof of concept. The advantage of this approach is that any user trace or Trace node output tends to be much smaller and easier to read. Once the small message set works, transfer the solution to the real one.
Shame that you cannot upgrade to v8 and use the DFDL parser - that would make the job much easier. |
|
Back to top |
|
 |
jacquesvdm |
Posted: Thu May 10, 2012 2:30 am Post subject: |
|
|
Apprentice
Joined: 18 Jan 2012 Posts: 29
|
Hi
The tags are missing in xml as well as in the MRM message tree when I debug.
I will do what you sugest and come back to you.
I could not pick up any problem in the tracefile but like you said it was a huge trace file. |
|
Back to top |
|
 |
jacquesvdm |
Posted: Thu May 10, 2012 4:00 am Post subject: |
|
|
Apprentice
Joined: 18 Jan 2012 Posts: 29
|
Hi
Unfortunately I get the same result with brand new flow and message set.
Here the full message set, I must be missing something or it is a bug in broker 7003.
Code: |
<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="complexType">
<xsd:sequence>
<xsd:element name="localElement" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep encodingNull="NullLiteralValue" encodingNullValue="''" messageSetDefaultRep="Text_CSV" precision="-1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="localElement1" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep encodingNull="NullLiteralValue" encodingNullValue="''" messageSetDefaultRep="Text_CSV" precision="-1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element minOccurs="0" name="localElement2" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep encodingNull="NullLiteralValue" encodingNullValue="''" messageSetDefaultRep="Text_CSV" precision="-1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="localElement3" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep encodingNull="NullLiteralValue" encodingNullValue="''" messageSetDefaultRep="Text_CSV" precision="-1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="localElement4" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep encodingNull="NullLiteralValue" encodingNullValue="''" messageSetDefaultRep="Text_CSV" precision="-1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="message1" type="complexType">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<MRMessage messageDefinition="/0/message1;XSDElementDeclaration$MRObject"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:schema>
|
Code: |
This is Line 1, field2,,field3,ff
This is Line 3, field2,,field3,gv
This is Line 4, field2,,field3,gf
|
Code: |
MRM
localElement:CHARACTER:This is Line 1
localElement1:CHARACTER: field2
localElement3:CHARACTER:field3
localElement4:CHARACTER:ff
|
|
|
Back to top |
|
 |
jacquesvdm |
Posted: Thu May 10, 2012 7:52 am Post subject: |
|
|
Apprentice
Joined: 18 Jan 2012 Posts: 29
|
Hi Kimbert
I notice that a new FP 4 was release 7 May and one of the fixes refers to "110621 MRM TDS parser not handling null data". I am hoping that this will solve my problem.
I will let you knwo as soon as I get it downloaded and installed. Most likely only tomorrow as I am going home now (18:00 in SA) |
|
Back to top |
|
 |
shanson |
Posted: Thu May 10, 2012 8:33 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Have you tried encodingNullValue="" ? |
|
Back to top |
|
 |
jacquesvdm |
Posted: Thu May 10, 2012 10:29 pm Post subject: |
|
|
Apprentice
Joined: 18 Jan 2012 Posts: 29
|
I have encodingNullValue="" and the result is the same.
I have installed Fix pack 004 and sad to say that it made no difference to how NULL values are handled within the TDS. I will log a PMR as this should work.  |
|
Back to top |
|
 |
shanson |
Posted: Fri May 11, 2012 12:12 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Just to be clear, when I say encodingNullValue="", that's what you should see in the mxsd file. Nothing between the double quotes. In your mxsd above you have single quotes between the double quotes. (In the editor the box appears as completely empty.)
Code: |
<xsd:element name="localElement" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep encodingNull="NullLiteralValue" encodingNullValue="" messageSetDefaultRep="Text_CSV" precision="-1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
|
|
|
Back to top |
|
 |
jacquesvdm |
Posted: Fri May 11, 2012 1:16 am Post subject: |
|
|
Apprentice
Joined: 18 Jan 2012 Posts: 29
|
I used the litteral value '' as well as "" and none of them worked. You were correct, my understanding was wrong.
Mayby the info centre should not read enter '' in the encodingNullValue but rather leave the field blank.
Much appreciated Shanson. You made me very happy now. |
|
Back to top |
|
 |
shanson |
Posted: Fri May 11, 2012 1:52 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Glad that worked. I have raised a ticket against the MB Infocenter topic to make the wording clearer. |
|
Back to top |
|
 |
|