i have 835 EDI file,
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~
how shall i extract ST value i.e. 000000001 and so on,
i tried to convert my edi file into XML format using SMOOKS first and then retrieving the data via parent and child node.
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);
}
Caused by: org.xml.sax.SAXException: Unknown/Unexpected UN/EDIFACT control block segment code 'ISA'.
if anyone can help me with the possible solution it would be great. Thanks in advance..
You are trying to parse an X12 835 by using EDIFACT parser.
Instead of UNEdifactInterchangeParser you need to use the corresponding X12 parser.