package com.jxml.quick.config;
import com.jxml.quick.*;
import com.jxml.protocol.*;
import org.xml.sax.*;
import java.io.*;
import java.util.*;

public class Main
{
	public static void main(String[] arg)
	{
		try
		{
			Protocol.addJXMLProtocolPackage();
     			ArrayList args=new ArrayList(Arrays.asList(arg));

			int sargs=args.size();
			if (sargs<1)
			{
				System.out.println("At least one arguments are always required:");
				System.out.println("    - The name of the config file!");
				return;
			}
			QDoc schema=CreateConfig.createSchema();
			QDoc doc=Quick.parse(schema,arg[0]);
			args.remove(0);
			Item item=(Item)doc.getRoot();

			TreeMap properties=new TreeMap();
			StringBuffer sb=new StringBuffer();
			properties.put("out",sb);
			item.eval(properties,args,null);
			System.out.print(sb.toString());
		}
		catch (Exception pe)
		{
			QPE.display(pe);
		}
	}
}
