Skip to content

Instantly share code, notes, and snippets.

@zubairov
Created February 14, 2011 13:05
Show Gist options
  • Save zubairov/825843 to your computer and use it in GitHub Desktop.
Save zubairov/825843 to your computer and use it in GitHub Desktop.
package org.talend.test;
import org.milyn.GenericReaderConfigurator;
import org.milyn.SmooksException;
import org.milyn.cdr.SmooksResourceConfiguration;
import org.milyn.smooks.edi.ModelLoader;
import org.milyn.smooks.edi.unedifact.UNEdifactReader;
public class Test {
public static void main(String[] args) throws SmooksException, Exception {
String modelURI = "urn:org.milyn.edi.unedifact:d99a-mapping:1.4";
org.milyn.Smooks smooks = new org.milyn.Smooks();
SmooksResourceConfiguration modelLoaderResource = new SmooksResourceConfiguration();
modelLoaderResource.setResource(ModelLoader.class.getName());
modelLoaderResource.setParameter("mappingModel", modelURI);
smooks.addConfiguration(modelLoaderResource);
GenericReaderConfigurator configurator = new GenericReaderConfigurator(
UNEdifactReader.class);
configurator.getParameters().setProperty("mappingModel",
modelURI);
configurator.getParameters().setProperty("ignoreNewLines", "true");
smooks.setReaderConfig(configurator);
smooks.filterSource(new javax.xml.transform.stream.StreamSource(
new java.io.FileInputStream("./99a_cuscar.edi")),
new javax.xml.transform.stream.StreamResult(System.out));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment