void () { try { InputSource inputSource = new InputSource(new StringReader(myFile.getText())); inputSource.setSystemId(myFile.getVirtualFile().getUrl().replace("file:", "file:/")); myParser.parse(inputSource, new DefaultHandler() { @Override public void warning(SAXParseException e) throws SAXException { if (myErrorReporter.isUniqueProblem(e)) myErrorReporter.processError(e, ProblemType.WARNING); } @Override public void error(SAXParseException e) throws SAXException { if (myErrorReporter.isUniqueProblem(e)) myErrorReporter.processError(e, ProblemType.ERROR); } @Override public void fatalError(SAXParseException e) throws SAXException { if (myErrorReporter.isUniqueProblem(e)) myErrorReporter.processError(e, ProblemType.FATAL); } @Override public InputSource resolveEntity(String publicId, String systemId) { final PsiFile psiFile = myXmlResourceResolver.resolve(null, systemId); if (psiFile == null) return null; return new InputSource(new StringReader(psiFile.getText())); } @Override public void startDocument() throws SAXException { super.startDocument(); myParser.setProperty( ENTITY_RESOLVER_PROPERTY_NAME, myXmlResourceResolver ); configureEntityManager(myFile, myParser); } }); final String[] resourcePaths = myXmlResourceResolver.getResourcePaths(); if (resourcePaths.length > 0) { // if caches are used final VirtualFile[] files = new VirtualFile[resourcePaths.length]; for (int i = 0; i < resourcePaths.length; ++i) { files[i] = UriUtil.findRelativeFile(resourcePaths[i], null); } myFile.putUserData(DEPENDENT_FILES_KEY, files); myFile.putUserData(GRAMMAR_POOL_TIME_STAMP_KEY, calculateTimeStamp(files, myProject)); } myFile.putUserData(KNOWN_NAMESPACES_KEY, getNamespaces(myFile)); } catch (SAXException e) { LOG.debug(e); } catch (Exception exception) { filterAppException(exception); } catch (StackOverflowError error) { // http://issues.apache.org/jira/browse/XERCESJ-589 } }