From 213238f61aa810d4640cef03fda1b48d4f9a7735 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Mon, 27 Sep 2010 16:17:35 +0400 Subject: [PATCH] getting xerces grammar from not well-formed docs --- .../intellij/xml/actions/ValidateXmlActionHandler.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xml/impl/src/com/intellij/xml/actions/ValidateXmlActionHandler.java b/xml/impl/src/com/intellij/xml/actions/ValidateXmlActionHandler.java index e21e9ac151bf..0eebd443fb63 100644 --- a/xml/impl/src/com/intellij/xml/actions/ValidateXmlActionHandler.java +++ b/xml/impl/src/com/intellij/xml/actions/ValidateXmlActionHandler.java @@ -42,6 +42,7 @@ import org.apache.xerces.jaxp.SAXParserFactoryImpl; import org.apache.xerces.util.XMLGrammarPoolImpl; import org.apache.xerces.xni.grammars.XMLGrammarPool; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.Nullable; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; @@ -423,7 +424,7 @@ public class ValidateXmlActionHandler { } } - private SAXParser createParser() { + protected SAXParser createParser() { try { if (!needsDtdChecking() && !needsSchemaChecking() && !myForceChecking) { return null; @@ -486,7 +487,7 @@ public class ValidateXmlActionHandler { } public static XMLGrammarPool getGrammarPool(XmlFile file, boolean forceChecking) { - final XMLGrammarPool previousGrammarPool = file.getUserData(GRAMMAR_POOL_KEY); + final XMLGrammarPool previousGrammarPool = getGrammarPool(file); XMLGrammarPool grammarPool = null; // check if the pool is valid @@ -503,6 +504,11 @@ public class ValidateXmlActionHandler { return grammarPool; } + @Nullable + public static XMLGrammarPool getGrammarPool(XmlFile file) { + return file.getUserData(GRAMMAR_POOL_KEY); + } + public static boolean isValidationDependentFilesOutOfDate(XmlFile myFile) { final VirtualFile[] files = myFile.getUserData(DEPENDENT_FILES_KEY); final Long grammarPoolTimeStamp = myFile.getUserData(GRAMMAR_POOL_TIME_STAMP_KEY);