How the edimap file has to look like? Smooks doesnt find any field

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How the edimap file has to look like? Smooks doesnt find any field

reto
This post has NOT been accepted by the mailing list yet.
I am using Smooks 1.5 and trying to generate an XML File from the EDI-Message I tried also with the standard Plugin, which generates a lof of namespaces, which I couldn't process cause of FreeMaker Template-Engine. This example is without FreeMaker-Engine.

I have a REMADV-message (Format D.01B) which looks like this:

UNA:+.?'
UNB+UNOC:3+4304449000000:14:7611937000723+7610603000005:14+141013:0901+949317133000++REMADV+++EANCOM+1'
UNH+1+REMADV:D:01B:UN:EAN005'
BGM+481+128275+9'
DTM+137:20141011000000:204'
DTM+138:20141017000000:204'
RFF+RA:128275'
RFF+AEK:490359'
PAI+1::42'
NAD+PR+7611937000723::9'
NAD+PE+7610603000005::9+++++++CH'
CUX+2:CHF:11'
DOC+380:::RG+26838'
MOA+12:61.12'
MOA+9:64.17'
MOA+265:-3.05'
MOA+109:-1.28'
DTM+137:20140924000000:204'
DTM+140:20141010000000:204'
...

My question is, how to I have to setup the Mapping-File? Do I need to specify each line or is it enough to only specify the fields which I am interested in?

My mapping file:
<medi:description name="MESSAGE" version="1.0"/>

<medi:delimiters segment="'!$" field="+" component=":" sub-component="~" />

<medi:segments xmltag="REMADV">

    <medi:segment minOccurs="1" maxOccurs="1" segcode="BGM" xmltag="Header">
        <medi:field xmltag="Code"/>
        <medi:field xmltag="Zahlungsavisnummer"/>
        <medi:field xmltag="Code2"/>
    </medi:segment> 
    <medi:segment minOccurs="1" maxOccurs="2" segcode="DTM" xmltag="DATE">
        <medi:field xmltag="abc" >
            <medi:component xmltag="1"/>
            <medi:component xmltag="2"/>
            <medi:component xmltag="3"/>     
        </medi:field>
    </medi:segment>


    <medi:segmentGroup xmltag="Dataset" maxOccurs="-1">

        <medi:segment minOccurs="0" maxOccurs="-1" segcode="DOC" xmltag="Rechnung" truncatable="true">
                <medi:field xmltag="Code"/>
                <medi:field xmltag="Belegart"/>
                <medi:field xmltag="Belegnummer"/>
        </medi:segment>

        <medi:segment minOccurs="0" maxOccurs="-1" segcode="MOA" xmltag="Rechnung" truncatable="true">
                <medi:field xmltag="Code"/>
                <medi:field xmltag="TotalAmount"/>
        </medi:segment>
    </medi:segmentGroup>   

       
    <medi:segment minOccurs="0" segcode="UNT" xmltag="EndsegmentDatensatz"/>


   
    <medi:segment minOccurs="0" segcode="UNZ" xmltag="EndsegmentDokument"/>
</medi:segments>

The smooks-config looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
                  xmlns:edi="http://www.milyn.org/xsd/smooks/edi-1.1.xsd">


<edi:reader mappingModel="REMADV-EDI-To-XML-Mapping.xml"/>

</smooks-resource-list>

The error message is always same:
Must be a minimum of 1 instances of segment [BGM].  Currently at segment number 1.

It looks like that it doesnt find any match Does someone has any idea why I cannot find any field inside the EDI-Message?