private void setupParser ()
    {
	// catch an illegal "nonsense" state.
	if (!prefixes && !namespaces)
	    throw new IllegalStateException ();

	nsSupport.reset();
	if (uris)
	    nsSupport.setNamespaceDeclUris (true);

	if (entityResolver != null) {
	    parser.setEntityResolver(entityResolver);
	}
	if (dtdHandler != null) {
	    parser.setDTDHandler(dtdHandler);
	}
	if (errorHandler != null) {
	    parser.setErrorHandler(errorHandler);
	}
	parser.setDocumentHandler(this);
	locator = null;
    }