} catch (SAXNotRecognizedException ex){ logger.error(ex);
saxFactory.setValidating(true); saxFactory.setNamespaceAware(true);
    public Validator( BrokerPool pool ){        logger.info("Initializing Validator.");                if(brokerPool==null){            this.brokerPool = pool;        }                // Check xerces version        try{            String version = org.apache.xerces.impl.Version.getVersion();                        if(!XERCESVERSION.equals(version)){                logger.error("Xerces version mismatch! eXist requires '"                             + XERCESVERSION+"' but found '"+version+"'. "                             + "Please add correct Xerces libraries to the "                             + "endorsed folder of your JRE or webcontainer.");            }                    } catch (Exception ex){            logger.error("Could not determine Xerces version. "                                                      + "Please add correct Xerces libraries to the "                         + "endorsed folder of your JRE or webcontainer.");        }                        // setup access to grammars ; be sure just one instance!        if(dbResources==null){            dbResources = new DatabaseResources(pool);        }        //        // setup enityResolver ; be sure just one instance!//        if(enityResolver==null){//            enityResolver = new EntityResolver(dbResources);//        }                // setup grammar brokerPool ; be sure just one instance!        if(grammarPool==null){            grammarPool = new GrammarPool();        }                // setup sax factory ; be sure just one instance!        if(saxFactory==null){            saxFactory = SAXParserFactory.newInstance();        }                // Enable validation stuff        saxFactory.setValidating(true);        saxFactory.setNamespaceAware(true);                try{            // Enable validation features of xerces            saxFactory.setFeature(FEATURE_DYNAMIC, true);            saxFactory.setFeature(FEATURE_SCHEMA,true);                    } catch (ParserConfigurationException ex){            logger.error(ex);                    } catch (SAXNotRecognizedException ex){            logger.error(ex);                    } catch (SAXNotSupportedException ex){            logger.error(ex);                    }    }