private void createMainParser() throws UnsupportedFormatVersionException {
	    try {
	    	// Obtain a new instance of a SAXParserFactory.
	    	SAXParserFactory factory = SAXParserFactory.newInstance();
	    	// Specifies that the parser produced by this code will provide support for XML namespaces.
	    	factory.setNamespaceAware(true);
    		factory.setValidating(false);
    		//Fix for delay when reading HOCR (disables loading the external DTD that is defined in the HOCR file)
    		factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
	    	
	    	//Validation
	    	if (validatorProvider != null && schemaVersion != null) {
	    		// Specifies that the parser produced by this code will validate documents as they are parsed.
	    		XmlValidator validator = validatorProvider.getValidator(schemaVersion);
	    		if (validator != null)
	    			factory.setSchema(validator.getSchema());
	    	}
	    	
		    //this.pageHandler = new PageHandler(validatorProvider, schemaVersion);
	    	this.pageHandler = SaxPageHandlerFactory.createHandler(validatorProvider, schemaVersion);
		    
	    	// Creates a new instance of a SAXParser using the currently configured factory parameters.
	    	mainParser = factory.newSAXParser();

	    } catch (UnsupportedFormatVersionException exc) {
	    	throw exc;
	    } catch (Throwable t) {
	    	t.printStackTrace();
	    }
	}