package org.drools.examples;

//import java.io.InputStreamReader;
//import java.io.Reader;
import java.io.*;

import org.drools.compiler.DrlParser;
import org.drools.xml.XmlDumper;
import org.drools.lang.descr.PackageDescr; 
public class FibonacciDrl2Xml {

    /**
     * @param args
     */
    public static void main(final String[] args) throws Exception {

    	final Reader source = new InputStreamReader( FibonacciExample.class.getResourceAsStream( "Fibonacci.drl" ) );
    	final DrlParser drlp= new DrlParser();
    	//OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream("D://output.txt"));
    	final PackageDescr astx = drlp.parse(source); 
    	String hope = new String();
      	XmlDumper xmldumper = new XmlDumper();
      	hope = xmldumper.dump(astx);
        System.out.print(hope);
        try {
        	FileWriter fw = new FileWriter(new File("d://HelloWorld.xml"));
        	fw.write(hope);
        	fw.flush();
        	fw.close();
        	} catch (IOException e){
        	}

        
      	
    }

        
}   	
    	