我正在尝试使用 Smooks(1.5 版)进行 EDI 到 XML 的映射。我有 5 个可能会出现几次的段,我想将它们分组,但一些错误正在上升:
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.
我的映射:
<?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>
我在 smooks.org 上阅读了文档,那里的示例看起来很相似。也许某些导入或 POM 文件有问题?请帮我解决这个问题。