I am trying to make EDI to XML mapping with Smooks (1.5 version). I have 5 segments which can occur few times and i want to put them into group but some Error is rising:
Caused by: org.xml.sax.SAXParseException; cvc-complex-type.2.4.a:
Invalid content was found starting with element 'medi:segmentGroup'.
One of '{"http://www.milyn.org/schema/edi-message-mapping-1.0.xsd":segment}' is expected.
My mapping:
<?xml version="1.0" encoding="UTF-8"?>
<medi:edimap xmlns:medi="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd">
<medi:description name="DVD Order" version="1.0" />
<medi:delimiters segment="'!$" field="+" component=":" sub-component="~" />
<medi:segments xmltag="Order">
<medi:segment segcode="BGM" xmltag="header" >
<medi:field xmltag="order-id" />
<medi:field xmltag="status-code" />
<medi:field xmltag="net-amount" />
</medi:segment>
<medi:segment segcode="DTM" xmltag="customer-details">
<medi:field xmltag="abc" >
<medi:component xmltag="1"/>
<medi:component xmltag="2"/>
<medi:component xmltag="3"/>
</medi:field>
</medi:segment>
<medi:segment segcode="NAD" xmltag="customer-details" maxOccurs="-1">
<medi:field xmltag="asd"></medi:field>
<medi:field xmltag="abc" >
<medi:component xmltag="1"/>
<medi:component xmltag="2"/>
<medi:component xmltag="3"/>
</medi:field>
</medi:segment>
<medi:segment xmltag="CURRENCY" segcode="CUX">
<medi:field xmltag="1st">
<medi:component xmltag="nth"/>
<medi:component xmltag="currency"/>
</medi:field>
<medi:field xmltag="number"/>
</medi:segment>
**<medi:segmentGroup>**
<medi:segment xmltag="Linia" segcode="PIA">
<medi:field xmltag="dig" />
<medi:field xmltag="item"/>
<medi:field xmltag="c">
<medi:component xmltag="1"/>
<medi:component xmltag="2"/>
<medi:component xmltag="3"/>
<medi:component xmltag="4"/>
</medi:field>
</medi:segment>
<medi:segment xmltag="Linia2" segcode="PIA">
<medi:field xmltag="item"/>
<medi:field xmltag="c">
<medi:component xmltag="1"/>
<medi:component xmltag="2"/>
<medi:component xmltag="3"/>
<medi:component xmltag="4"/>
</medi:field>
</medi:segment>
<medi:segment xmltag="prim" segcode="PRI">
<medi:field xmltag="c">
<medi:component xmltag="1"/>
<medi:component xmltag="2"/>
<medi:component xmltag="3"/>
<medi:component xmltag="4"/>
<medi:component xmltag="5"/>
<medi:component xmltag="6"/>
</medi:field>
</medi:segment>
<medi:segment xmltag="SCC" segcode="SCC" >
<medi:field xmltag="1"/>
</medi:segment>
<medi:segment xmltag="QTY" segcode="QTY" >
<medi:field xmltag="qty">
<medi:component xmltag="1"/>
<medi:component xmltag="2"/>
<medi:component xmltag="3"/>
</medi:field>
</medi:segment>
<medi:segment xmltag="DTM" segcode="DTM">
<medi:field xmltag="dtm">
<medi:component xmltag="1"/>
<medi:component xmltag="2"/>
<medi:component xmltag="3"/>
</medi:field>
</medi:segment>
**</medi:segmentGroup>**
</medi:segments>
</medi:edimap>
I read docs on smooks.org and examples there looks similar. Maybe there is problem with some imports or POM file? Please help me with this solution.
There was a problem with version of edi-message-mapping. Version 1.0 doesn't support segmentGroups. There should look like:
<medi:edimap xmlns:medi="http://www.milyn.org/schema/edi-message-mapping-1.5.xsd">