FileDocCategorySizeDatePackage
TrAXFilter.javaAPI DocJava SE 5 API4185Fri Aug 26 14:55:42 BST 2005com.sun.org.apache.xalan.internal.xsltc.trax

TrAXFilter

public class TrAXFilter extends XMLFilterImpl
skeleton extension of XMLFilterImpl for now.
author
Santiago Pericas-Geertsen
author
G. Todd Miller

Fields Summary
private Templates
_templates
private TransformerImpl
_transformer
private TransformerHandlerImpl
_transformerHandler
Constructors Summary
public TrAXFilter(Templates templates)

	_templates = templates;
	_transformer = (TransformerImpl) templates.newTransformer();
        _transformerHandler = new TransformerHandlerImpl(_transformer);
    
Methods Summary
private voidcreateParent()

	XMLReader parent = null;
        try {
            SAXParserFactory pfactory = SAXParserFactory.newInstance();
            pfactory.setNamespaceAware(true);
            SAXParser saxparser = pfactory.newSAXParser();
            parent = saxparser.getXMLReader();
        }
        catch (ParserConfigurationException e) {
            throw new SAXException(e);
        }
        catch (FactoryConfigurationError e) {
            throw new SAXException(e.toString());
        }

        if (parent == null) {
            parent = XMLReaderFactory.createXMLReader();
        }

        // make this XMLReader the parent of this filter
        setParent(parent);
    
public javax.xml.transform.TransformergetTransformer()

        return _transformer;
    
public voidparse(org.xml.sax.InputSource input)

        XMLReader managedReader = null;

        try {
            if (getParent() == null) {
                try {
                    managedReader = XMLReaderManager.getInstance()
                                                    .getXMLReader();
                    setParent(managedReader);
                } catch (SAXException  e) {
                    throw new SAXException(e.toString());
                }
            }

            // call parse on the parent
            getParent().parse(input);
        } finally {
            if (managedReader != null) {
                XMLReaderManager.getInstance().releaseXMLReader(managedReader);
            }
        }
    
public voidparse(java.lang.String systemId)

        parse(new InputSource(systemId));
    
public voidsetContentHandler(org.xml.sax.ContentHandler handler)

	_transformerHandler.setResult(new SAXResult(handler));
	if (getParent() == null) {
                try {
                    createParent();
                }
                catch (SAXException  e) {
                   return; 
                }
	}
	getParent().setContentHandler(_transformerHandler);
    
public voidsetErrorListener(javax.xml.transform.ErrorListener handler)