There is no "stable" API for obtaining the generated DRL. 5.2.0 introduces
several debug options (see the Expert documentation), and one of them
displays the generated DRL.

For earlier version, you can use:

import org.drools.lang.dsl.DefaultExpander;
import org.drools.lang.dsl.DSLTokenizedMappingFile;

DSLTokenizedMappingFile mapfile = new DSLTokenizedMappingFile();
DefaultExpander expander = new DefaultExpander();
Reader dslReader = ...;
Reader dslrReader = ...;
String drl;

try {
     mapfile.parseAndLoad( dslReader );
     expander.addDSLMapping( mapfile.getMapping() );
     drl = expander.expand( dslrReader );
} catch ( IOException e ) {
}

-W

On 8 May 2011 02:20, boy18nj <[email protected]> wrote:

> I was wandering through the documentation and Google, not able to find
> understood able code which helps me to generate internal DRL out of DSL and
> DSLR. Because this helps me to clearly find out the problem with my DSL and
> DSLR.
>
> Please post the code which reads the DSL & DSLR from classpath and spits
> out
> DRL.
>
>
> Thanks in advance.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-generate-DRL-out-of-DSL-and-DSLR-tp2913960p2913960.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to