Java 中有没有好的开源 EDIFACT 解析器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2794262/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there any good open source EDIFACT parser in Java?
提问by Johannes Brodwall
Parsing EDIFACT can be a daunting undertaking. Is there any good open source library that can help?
解析 EDIFACT 可能是一项艰巨的任务。有什么好的开源库可以提供帮助吗?
采纳答案by Chris K
www.smooks.org- A template-based text parser. They have suitable EDI examples that I was looking to use to implement for Walmart 810s before they dumped my products.
www.smooks.org- 基于模板的文本解析器。他们有合适的 EDI 示例,我希望在他们倾销我的产品之前为 Walmart 810 实施这些示例。
回答by ZZ Coder
Parsing EDIFACT is easy. You can find many libraries to do it. For example,
解析 EDIFACT 很容易。您可以找到许多库来执行此操作。例如,
http://code.google.com/p/edicoder/
http://code.google.com/p/edicoder/
All these libraries simply break up the messages into segments.
所有这些库都只是将消息分解成段。
The hard part with EDIFACT is to transform the message into some meaningful objects. This is very application specific and I doubt you will find any libraries. Even if you find one, it will be specific to a narrow field, like hotel reservation.
EDIFACT 的难点在于将消息转换为一些有意义的对象。这是非常特定于应用程序的,我怀疑您会找到任何库。即使你找到了,它也将特定于一个狭窄的领域,比如酒店预订。
回答by eppye
try: http://bots.sourceforge.netnot so much a library, but translates edifact to the format you prefer....xml....csv....etc
尝试:http: //bots.sourceforge.net 与其说是一个库,不如说是将 edifact 转换为您喜欢的格式....xml....csv....etc
回答by Strubhar
There is a good one at http://x12parser.codeplex.com. It will output any 810 as xml, html or back to text with whitespace for easier inspection. The unit tests includes a sample of the Walmart 810 from the site: http://www.jobisez.com/edi/tp/guide.aspx?doc=/edi-igs/Walmart/810Invoice5010.pdf.
http://x12parser.codeplex.com 上有一个很好的。它会将任何 810 输出为 xml、html 或返回带有空格的文本,以便于检查。单元测试包括来自以下站点的 Walmart 810 示例:http: //www.jobisez.com/edi/tp/guide.aspx? doc=/edi-igs/Walmart/810Invoice5010.pdf 。
The formatted text would look like this:
格式化文本如下所示:
ISA*00* *00* *16*102096559TEST *14*PARTNERTEST *071214*1406*U*00040*810000263*1*T*>
GS*IN*102096559TEST*PARTNER*20071214*1406*810000263*X*004010
ST*810*0001
BIG*20050205*6463367*20050202*3376103367
REF*IA*123456170
REF*DP*00017
REF*MR*0020
N1*SU*SUPPLIER NAME
N1*ST*WAL-MART 100*UL*0078742000992
N3*406 SOUTH WALTON BLVD
N4*BENTONVILLE*AR*72712
ITD*05*15*****45
DTM*011*20050205
FOB*CC
IT1**1080*EA*3.61**IN*001719653*UP*022108955228*UK*00221089552284
PID*F****ITEM DESCRIPTION
SAC*A*I410***2350*******02
TDS*387530
CAD*T***RDWT*ROADWAY**BM*123456789
ISS*1080*EA*100*LB
CTT*1
SE*19*0001
GE*1*810000263
IEA*1*810000263
回答by Rajasekaran Kandhasamy
We have implemented 834 EDI to XML using Java + Smooks 1.6. It's awesome!
我们已经使用 Java + Smooks 1.6 实现了 834 EDI 到 XML。这很棒!
<?xml version="1.0" encoding="UTF-8"?>
<medi:description name="834 EDI TO XML" version="1.0" />
<medi:delimiters segment=" " field="*" component="^"
sub-component="#" escape="~"/>
<medi:segments xmltag="FILE">
<medi:segment segcode="ISA" xmltag="ISAHeader">
<medi:field xmltag="AuthorziationInformationQualifier" />
<medi:field xmltag="AuthorziationInformation" />
<medi:field xmltag="SecurityInformationQualifier" />
<medi:field xmltag="InterchangeIDQualifier" />
<medi:field xmltag="InterchangeSenderID" />
<medi:field xmltag="InterchangeIDQualifier" />
<medi:field xmltag="InterchangeReceiverID" />
<medi:field xmltag="InterchangeDate" />
<medi:field xmltag="InterchangeTime" />
<medi:field xmltag="RepetitionSeparator" />
<medi:field xmltag="InterchangeControlVersionNumber" />
<medi:field xmltag="InterchangeControlNumber" />
<medi:field xmltag="AcknowledgmentRequested" />
<medi:field xmltag="InterchangeUsageIndicator" />
<medi:field xmltag="ComponentElementSeparator" />
</medi:segment>
<medi:segmentGroup xmltag="BenefitEnrollmentRequest" maxOccurs="-1">
<medi:segment minOccurs="0" maxOccurs="-1" segcode="GS" xmltag="BenefitEnrollmentRequestHeader">
<medi:field xmltag="FunctionalIDCode" />
<medi:field xmltag="ApplicationSendsCode" />
<medi:field xmltag="ApplicationRecsCode" />
<medi:field xmltag="Date" />
<medi:field xmltag="Time" />
<medi:field xmltag="GroupCtrlNumber" />
<medi:field xmltag="ResponsibleAgencyCode" />
<medi:field xmltag="ReleaseIDCode" />
</medi:segment>
<medi:segmentGroup xmltag="BenefitEnrollmentMaintenance" maxOccurs="-1">
<medi:segment minOccurs="0" maxOccurs="-1" segcode="ST" xmltag="BenefitEnrollmentMaintenanceHeader">
<medi:field xmltag="TransactionSetIdentifierCode" />
<medi:field xmltag="TransactionSetControlNumber" />
<medi:field xmltag="ImplementationConventionReference" />
</medi:segment>
<medi:segment minOccurs="0" segcode="BGN" xmltag="Begin" ignoreUnmappedFields="true">
<medi:field xmltag="TSPurposeCode" />
<medi:field xmltag="ReferenceIdent" />
<medi:field xmltag="Date" />
<medi:field xmltag="Time" />
<medi:field xmltag="TimeCode" />
<medi:field xmltag="ReferenceIdent" />
<medi:field xmltag="TransactionTypeCode" />
<medi:field xmltag="ActionCode" />
</medi:segment>
<medi:segment minOccurs="0" segcode="REF" xmltag="Ref_38" ignoreUnmappedFields="true">
<medi:field xmltag="ReferenceIdentQual" />
<medi:field xmltag="ReferenceIdent" />
</medi:segment>
<medi:segment minOccurs="0" segcode="DTP" xmltag="Dtp_007" ignoreUnmappedFields="true">
<medi:field xmltag="DateTimeQualifier" />
<medi:field xmltag="DateTimePeriodFormatQualifier" />
<medi:field xmltag="DateTimePeriod" />
</medi:segment>
<medi:segment minOccurs="0" segcode="QTY" xmltag="To" ignoreUnmappedFields="true">
<medi:field xmltag="QuantityQualifier" />
<medi:field xmltag="Quantity" />
</medi:segment>
<medi:segment minOccurs="0" segcode="N1" xmltag="Sponsor" ignoreUnmappedFields="true">
<medi:field xmltag="EntityIDCode" />
<medi:field xmltag="Name" />
<medi:field xmltag="IDCodeQualifier" />
<medi:field xmltag="IDCode" />
</medi:segment>
<medi:segment minOccurs="0" segcode="N1" xmltag="Issuer" ignoreUnmappedFields="true">
<medi:field xmltag="EntityIDCode" />
<medi:field xmltag="Name" />
<medi:field xmltag="IDCodeQualifier" />
<medi:field xmltag="IDCode" />
</medi:segment>
<medi:segment minOccurs="0" segcode="N1" xmltag="Agent" ignoreUnmappedFields="true">
<medi:field xmltag="EntityIDCode" />
<medi:field xmltag="Name" />
<medi:field xmltag="IDCodeQualifier" />
<medi:field xmltag="IDCode" />
<medi:segment minOccurs="0" segcode="ACT" xmltag="Act" ignoreUnmappedFields="true">
<medi:field xmltag="AccountNumber" />
<medi:field xmltag="Name" />
<medi:field xmltag="IDCodeQualifier" />
<medi:field xmltag="IDCode" />
<medi:field xmltag="AcctNumberQualifier" />
<medi:field xmltag="AccountNumber" />
</medi:segment>
</medi:segment>
<medi:segment minOccurs="0" segcode="N1" xmltag="Broker" ignoreUnmappedFields="true">
<medi:field xmltag="EntityIDCode" />
<medi:field xmltag="Name" />
<medi:field xmltag="IDCodeQualifier" />
<medi:field xmltag="IDCode" />
<medi:segment minOccurs="0" segcode="ACT" xmltag="Act" ignoreUnmappedFields="true">
<medi:field xmltag="AccountNumber" />
<medi:field xmltag="Name" />
<medi:field xmltag="IDCodeQualifier" />
<medi:field xmltag="IDCode" />
<medi:field xmltag="AcctNumberQualifier" />
<medi:field xmltag="AccountNumber" />
</medi:segment>
</medi:segment>
<!--
<medi:segment minOccurs="0" segcode="N1" xmltag="Sponsor">
<medi:field xmltag="Name" />
</medi:segment>
<medi:segmentGroup xmltag="Member" maxOccurs="-1">
<medi:segment minOccurs="0" maxOccurs="-1" segcode="INS" xmltag="MemberHeader">
<medi:field xmltag="HeaderName" />
</medi:segment>
<medi:segment minOccurs="0" segcode="DTP" xmltag="DOB">
<medi:field xmltag="Month" />
</medi:segment>
<medi:segment minOccurs="0" maxOccurs="-1" segcode="LE" xmltag="MemberFooter" ignoreUnmappedFields="true">
<medi:field xmltag="FooterName"/>
</medi:segment>
</medi:segmentGroup>-->
<medi:segment minOccurs="0" segcode="SE" xmltag="BenefitEnrollmentMaintenanceFooter">
<medi:field xmltag="TransactionSetIdentifierCode" />
<medi:field xmltag="TransactionSetControlNumber" />
</medi:segment>
</medi:segmentGroup>
<medi:segment minOccurs="0" segcode="GE" xmltag="BenefitEnrollmentRequestFooter">
<medi:field xmltag="ZFA" />
</medi:segment>
</medi:segmentGroup>
<medi:segment segcode="IEA" xmltag="ISAFooter">
<medi:field xmltag="CCC" />
</medi:segment>
</medi:segments>