Author |
Message
|
somsayan |
Posted: Thu Apr 16, 2015 8:30 am Post subject: Need DFDL library to not trim the leading spaces |
|
|
Apprentice
Joined: 06 Apr 2007 Posts: 49
|
Hi All,
We are using Message Broker 8.0.0.4 on AIX box. The requirement we have is to extract IDOCs out of SAP and for that we have built a flow and it processes the particular IDOC using DFDL.
The IDOC has a particular field in the segment that is right justified and it is padded with ' ' (Space). Naturally the DFDL that got generated via IDOC discovery is trimming the space in front of the data.
Now comes the unnatural requirement to 'not trim' the data. How can we achieve this?
We have tried the to change the XSD to incorporate the requirement
Code: |
<xsd:element maxOccurs="1" minOccurs="0" name="FIELD1" nillable="true">
<xsd:annotation xml:space="preserve">
<xsd:appinfo source="http://www.ibm.com/xmlns/prod/websphere/j2ca/sap/metadata">
<sapasi:sapALEPropertyTypeMetadata>
<sapasi:FieldName>FIELD1</sapasi:FieldName>
<sapasi:SegmentHierarchy>0</sapasi:SegmentHierarchy>
<sapasi:OffSet>21</sapasi:OffSet>
<sapasi:PrimaryKey>false</sapasi:PrimaryKey>
<sapasi:MaxLength>229</sapasi:MaxLength>
<sapasi:ForeignBOKeyRef/>
</sapasi:sapALEPropertyTypeMetadata>
</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="229"/>
[color=red]<xsd:whiteSpace value="preserve"/>[/color]
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
|
But this is not working.
Can anyone suggest a way out ? |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 16, 2015 8:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
probably just make it a fixed length field. |
|
Back to top |
|
 |
somsayan |
Posted: Thu Apr 16, 2015 9:10 am Post subject: |
|
|
Apprentice
Joined: 06 Apr 2007 Posts: 49
|
Hi mqjeff,
It is a fixed length field. Its the DFDL that trims out the leading and trailing ' '.
What I would like is to not trim that. Hence added the <xsd:whiteSpace value="preserve"/>line in the xsd. But that doesn't seem to work.
Is there any other way to make it work ? |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Apr 16, 2015 9:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
somsayan wrote: |
Hi mqjeff,
It is a fixed length field. Its the DFDL that trims out the leading and trailing ' '.
What I would like is to not trim that. Hence added the <xsd:whiteSpace value="preserve"/>line in the xsd. But that doesn't seem to work.
Is there any other way to make it work ? |
I presume your DFDL field is set to right justified padded... What type of value is in this field. If it is something that needs to keep the leading blanks, than a right justified field is may be not the way to go...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Thu Apr 16, 2015 1:13 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
What I would like is to not trim that. Hence added the <xsd:whiteSpace value="preserve"/>line in the xsd. |
Everything that you need to know about padding and trimming in DFDL is in the specification:
http://www-01.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.dfdl.spec.doc/dfdl_index.htm
The xsd:whiteSpace facet is not useful for DFDL because it does not allow the required amount of control over white space handling. So the specification explicitly states that it is not used. _________________ 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 |
|
 |
shanson |
Posted: Fri Apr 17, 2015 6:39 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Add dfdl:textTrimKind="none" to all the elements for which you do not want trimming to occur. |
|
Back to top |
|
 |
somsayan |
Posted: Mon Apr 20, 2015 4:31 am Post subject: |
|
|
Apprentice
Joined: 06 Apr 2007 Posts: 49
|
Hi Shanson, kimbert
Thanks for your reply. But when we are generating the library using Discovery, we are creating only xsd files and there are no dfdl files created.
Are we missing something ? |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Apr 20, 2015 4:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
somsayan wrote: |
Hi Shanson, kimbert
Thanks for your reply. But when we are generating the library using Discovery, we are creating only xsd files and there are no dfdl files created.
Are we missing something ? |
Don't use Discovery. Get and example and Use the DFDL editor's discovery facilities? _________________ MQ & Broker admin |
|
Back to top |
|
 |
shanson |
Posted: Mon Apr 20, 2015 6:34 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Please explain exactly what your message flow is doing.
If you are using adapter discovery to create the xsds then you will be using DataObject domain and not DFDL.
Are you using a generic IDoc, and trying to parse it using DFDL? |
|
Back to top |
|
 |
somsayan |
Posted: Mon Apr 20, 2015 7:23 am Post subject: |
|
|
Apprentice
Joined: 06 Apr 2007 Posts: 49
|
Hi shanson,
I'm using DataObject and not DFDL. Sorry for the confusion. |
|
Back to top |
|
 |
jhosie |
Posted: Tue Apr 21, 2015 4:15 am Post subject: |
|
|
Apprentice
Joined: 12 May 2005 Posts: 28
|
The recommended way to configure the DataObject parsing is to use the Adapter wizard rather than editing the xsd directly.
You can reconfigure an existing adapter by right clicking on it and chosing "iterative discovery".
In that wizard, on the page with the title "Service Generation and Deployment Configuration", expand the Advanced twistie, and you will see "ALE Data Format configuration" and in that section an option to "Trim ALE IDoc field data". It defaults to true (checked) but it you unckeck it, I am pretty sure that will mean that your white space will be preserved. |
|
Back to top |
|
 |
somsayan |
Posted: Tue Apr 21, 2015 7:11 am Post subject: |
|
|
Apprentice
Joined: 06 Apr 2007 Posts: 49
|
jhosie wrote: |
In that wizard, on the page with the title "Service Generation and Deployment Configuration", expand the Advanced twistie, and you will see "ALE Data Format configuration" and in that section an option to "Trim ALE IDoc field data". It defaults to true (checked) but it you unckeck it, I am pretty sure that will mean that your white space will be preserved. |
Hi jhosie,
That was the first option we tried. We couldn't make it to work. |
|
Back to top |
|
 |
shanson |
Posted: Tue Apr 21, 2015 8:20 am Post subject: |
|
|
 Partisan
Joined: 17 Oct 2003 Posts: 344 Location: IBM Hursley
|
Is there any difference between the xsd created with the option checked, and the xsd created with the option not checked? |
|
Back to top |
|
 |
somsayan |
Posted: Tue Apr 21, 2015 1:08 pm Post subject: |
|
|
Apprentice
Joined: 06 Apr 2007 Posts: 49
|
shanson wrote: |
Is there any difference between the xsd created with the option checked, and the xsd created with the option not checked? |
No there isn't any difference between the contents of the two xsd's. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Apr 22, 2015 4:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Can you explain why you need the trailing spaces?
SAP doesn't care so much about the trailing spaces... It will fill them in as it creates and populates the field....  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|