Created
February 14, 2011 13:05
-
-
Save zubairov/825843 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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