我有 835 EDI 文件,
ISA*00* *00* *33*83876 *ZZ*B00482000 *190128*1100*^*00501*000000001*0*T*:~
ST*835*000000001~
BPR*H*0*C*NON************20190128~
TRN*1*PK673981180*141138499245*PS0087726~
REF*EV*B048499999800~
REF*F2*1083~
DTM*405*20190128~
我应该如何提取 ST 值,即 000000001 等等,
我尝试先使用 SMOOKS 将我的 edi 文件转换为 XML 格式,然后通过父节点和子节点检索数据。
public static void main(String[] args) throws SmooksException, Exception {
String modelURI = "urn:org.milyn.edi.unedifact:d99a-mapping:1.4";
UNEdifactInterchangeParser parser = new UNEdifactInterchangeParser();
// parser.addMappingModels(modelURI, new URI("/"));
parser.setFeature(EDIParser.FEATURE_IGNORE_NEWLINES, true);
SAXHandler handler = new SAXHandler();
parser.setContentHandler(handler);
parser.parse(new InputSource(new java.io.FileInputStream(
"myEDIfile.edi")));
Document doc = handler.getDocument();
// Here you have your document
new XMLOutputter(Format.getPrettyFormat()).output(doc, System.out);
}
但我收到错误
原因:org.xml.sax.SAXException:未知/意外的 UN/EDIFACT 控制块段代码“ISA”。
如果有人可以帮助我解决可能的解决方案,那就太好了。提前致谢..