Smooks smooks = new Smooks();
DfdlSchema dfdlSchema = new DfdlSchema(new URI("/edi/850/mapping.dfdl.xsd"), new HashMap<String, String>() {{
this.put("segmentTerminator", "~%NL;");
this.put("dataElementSeparator", "*");
this.put("compositeDataElementSeparator", ":");
this.put("escapeCharacter", "?");
this.put("repetitionSeparator", "*");
this.put("decimalSign", ".");
this.put("triadSeparator", ",");
}}, ValidationMode.Full, false, false, null);
DfdlUnparser dfdlUnparser = new DfdlUnparser(dfdlSchema.compile());
// this is required because of a bug in DfdlUnparser
ResourceConfig resourceConfig = new DefaultResourceConfig();
resourceConfig.setParameter("schemaURI", "");
smooks.getApplicationContext().getRegistry().lookup(new LifecycleManagerLookup()).applyPhase(dfdlUnparser, new PostConstructLifecyclePhase(new Scope(smooks.getApplicationContext().getRegistry(), resourceConfig, dfdlUnparser)));
///////////////////////////////////////////////////
smooks.addVisitor(dfdlUnparser, "/Order");
--
You received this message because you are subscribed to the Google Groups "Smooks Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smooks-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/f84eeb00-db1e-4360-9001-977c2951608cn%40googlegroups.com.
protected static String runSmooksTransform() throws Throwable {
Locale defaultLocale = Locale.getDefault();
Locale.setDefault(new Locale("en", "IE"));
Smooks smooks = new Smooks();
DfdlSchema dfdlSchema = new DfdlSchema(new URI("/edi-to-xml-mapping.dfdl.xsd"),
new HashMap<String, String>() {{
this.put("segmentTerminator", "%NL;");
this.put("dataElementSeparator", "+");
this.put("compositeDataElementSeparator", "^");
this.put("escapeCharacter", "?");
this.put("repetitionSeparator", "*");
this.put("decimalSign", ".");
this.put("triadSeparator", ",");
}}, ValidationMode.Full, false, false, null);
DfdlUnparser dfdlUnparser = new DfdlUnparser(dfdlSchema.compile());
// this is required because of a bug in DfdlUnparser
ResourceConfig resourceConfig = new DefaultResourceConfig();
resourceConfig.setParameter("schemaURI", "");
smooks.getApplicationContext().getRegistry().lookup(new LifecycleManagerLookup())
.applyPhase(dfdlUnparser, new PostConstructLifecyclePhase(
new Scope(smooks.getApplicationContext().getRegistry(), resourceConfig,
dfdlUnparser)));
///////////////////////////////////////////////////
smooks.addVisitor(dfdlUnparser, "/Order");
try {
StringResult result = new StringResult();
// Filter the input message to the outputWriter, using the execution context...
smooks.filterSource(new StreamSource(new ByteArrayInputStream(messageIn)), result);
Locale.setDefault(defaultLocale);
return result.getResult();
} finally {
smooks.close();
}
}
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/CADvAAuiZv3mpLtDMKcyb18xbqBM5qum3CnOU0EGzcq0tC6KKSg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/CABuL3Dh5nDAkoKEUQEHwzcnLAi4F_FfntX_G6ZN%2BH4SpY0Cqdg%40mail.gmail.com.
<smooks-resource-list xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
xmlns:edi="https://www.smooks.org/xsd/smooks/edi-2.0.xsd"
xmlns:core="https://www.smooks.org/xsd/smooks/smooks-core-1.6.xsd">
<core:smooks filterSourceOn="/Order">
<core:action>
<core:inline>
<core:replace/>
</core:inline>
</core:action>
<core:config>
<smooks-resource-list>
<edi:unparser unparseOnElement="*" schemaURI="/edi-to-xml-mapping.dfdl.xsd"
segmentTerminator="%NL;" compositeDataElementSeparator="^" debugging="true"/>
</smooks-resource-list>
</core:config>
</core:smooks>
</smooks-resource-list>
protected static String runSmooksTransform() throws Throwable {
Locale defaultLocale = Locale.getDefault();
Locale.setDefault(new Locale("en", "IE"));
Smooks smooks = new Smooks();
DfdlSchema dfdlSchema = new DfdlSchema(new URI("/edi-to-xml-mapping.dfdl.xsd"),
new HashMap<String, String>() {{
this.put("{http://www.ibm.com/dfdl/EDI/Format}SegmentTerm", "%NL;");
this.put("{http://www.ibm.com/dfdl/EDI/Format}FieldSep", "+");
this.put("{http://www.ibm.com/dfdl/EDI/Format}CompositeSep", "^");
this.put("{http://www.ibm.com/dfdl/EDI/Format}EscapeChar", "?");
this.put("{http://www.ibm.com/dfdl/EDI/Format}RepeatSep", "*");
this.put("{http://www.ibm.com/dfdl/EDI/Format}DecimalSep", ".");
this.put("{http://www.ibm.com/dfdl/EDI/Format}GroupingSep", ",");
}}, ValidationMode.Full, false, false);
DfdlUnparser dfdlUnparser = new DfdlUnparser(dfdlSchema.compile());
// this is required because of a bug in DfdlUnparser
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.setParameter("schemaURI", "");
smooks.getApplicationContext().getRegistry().lookup(new LifecycleManagerLookup())
.applyPhase(dfdlUnparser, new PostConstructLifecyclePhase(
new Scope(smooks.getApplicationContext().getRegistry(), resourceConfig,
dfdlUnparser)));
///////////////////////////////////////////////////
smooks.addVisitor(dfdlUnparser, "/Order");
try {
StringResult result = new StringResult();
// Filter the input message to the outputWriter, using the execution context...
smooks.filterSource(new StreamSource(new ByteArrayInputStream(messageIn)), result);
Locale.setDefault(defaultLocale);
return result.getResult();
} finally {
smooks.close();
}
}
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/CADvAAuhFN7HSknJDsYiXBc485Ks83YXgfD0jHcrNO6fO8Qs0Zw%40mail.gmail.com.
How can I write 'Inline replace' by code? How can I configure 'Pipeline' programmatically?
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/CABuL3Dj53DdX0GDfU67HFgFNvjXCB3BKJW5rn2OC5AoCWwAKeg%40mail.gmail.com.
protected static String runSmooksTransform() throws Throwable {
Locale defaultLocale = Locale.getDefault();
Locale.setDefault(new Locale("en", "IE"));
Smooks smooks = new Smooks();
DfdlSchema dfdlSchema = new DfdlSchema(new URI("/edi-to-xml-mapping.dfdl.xsd"),
new HashMap<String, String>() {{
this.put("{http://www.ibm.com/dfdl/EDI/Format}SegmentTerm", "%NL;");
this.put("{http://www.ibm.com/dfdl/EDI/Format}FieldSep", "+");
this.put("{http://www.ibm.com/dfdl/EDI/Format}CompositeSep", "^");
this.put("{http://www.ibm.com/dfdl/EDI/Format}EscapeChar", "?");
this.put("{http://www.ibm.com/dfdl/EDI/Format}RepeatSep", "*");
this.put("{http://www.ibm.com/dfdl/EDI/Format}DecimalSep", ".");
this.put("{http://www.ibm.com/dfdl/EDI/Format}GroupingSep", ",");
}}, ValidationMode.Full, false, false, null);
DfdlUnparser dfdlUnparser = new DfdlUnparser(dfdlSchema.compile());
// this is required because of a bug in DfdlUnparser
ResourceConfig resourceConfig = new DefaultResourceConfig();
resourceConfig.setParameter("schemaURI", "");
smooks.getApplicationContext().getRegistry().lookup(new LifecycleManagerLookup())
.applyPhase(dfdlUnparser, new PostConstructLifecyclePhase(
new Scope(smooks.getApplicationContext().getRegistry(), resourceConfig,
dfdlUnparser)));
///////////////////////////////////////////////////
smooks.addVisitor(dfdlUnparser, "*");
smooks.setFilterSettings(FilterSettings.newSaxNgSettings().setDefaultSerializationOn(false));
try {
StringResult result = new StringResult();
// Filter the input message to the outputWriter, using the execution context...
smooks.filterSource(new StreamSource(new ByteArrayInputStream(messageIn)), result);
Locale.setDefault(defaultLocale);
return result.getResult();
} finally {
smooks.close();
}
}
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/CADvAAujAs0Yi6UsMNkJA%3DzG_Cph5R80nyVZF%2BcK2r7NCi0jo3w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/CABuL3DjUmJ4N_57OpVMuR1qYr_Qh4ewOpq%3Dpw81ro88Lcdru4A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/CADvAAujTjQfncCdPv%2B3f_g6FO6nUxW1qk%2Bt_gubK-GMCXJynjA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/CABuL3Dijgo2Ghhihs0GGSsPJkrUWrGYzH53iMpq4%2BwSHsmmLnw%40mail.gmail.com.