Skip to content

Instantly share code, notes, and snippets.

@zubairov
Created February 14, 2011 13:08
Show Gist options
  • Save zubairov/825845 to your computer and use it in GitHub Desktop.
Save zubairov/825845 to your computer and use it in GitHub Desktop.
package org.talend.test;
import java.net.URI;
import org.jdom.Document;
import org.jdom.input.SAXHandler;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.milyn.SmooksException;
import org.milyn.edisax.EDIParser;
import org.milyn.edisax.unedifact.UNEdifactInterchangeParser;
import org.xml.sax.InputSource;
public class Test2 {
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(
"./99a_cuscar.edi")));
Document doc = handler.getDocument();
// Here you have your document
new XMLOutputter(Format.getPrettyFormat()).output(doc, System.out);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment