// copyright => http://www.jxml.com/mdsax/License.txt

package com.jxml.quick;
import java.util.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;

public abstract class QContext extends QBaseFilter
{
    public QDoc doc=null;
    public Locator locator=null;
    public QFilterFactory.QFilter filter=null;
    public boolean expressDefaults=false;
    public ClassLoader cl=null;

    public Class forName(String className)
	throws QPE
    {
	try
	    {
		Class c;
		if (cl==null)
			c=Class.forName(className);
		else
			c=cl.loadClass(className);
		return c;
	    }
	catch (Exception cnfe)
	    {
		throwPE(cnfe);
		return null;
	    }
    }

    public void throwPE(String message)
	throws QPE
    {
	    throw new QPE(message,this);
    }

    public void throwPE(Exception exception)
	throws QPE
    {
	if (exception instanceof SAXParseException)
		throw new QPE(((SAXParseException)exception),this);
	else
		throw new QPE(exception,this);
    }

    public abstract void walk(QDoc doc, QContext outputContext)
	throws QPE;
}
