diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/XmlSimpleHighlightingTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/XmlSimpleHighlightingTest.java index 0eb9024bf59f..8f764830c251 100644 --- a/xml/tests/src/com/intellij/codeInsight/daemon/XmlSimpleHighlightingTest.java +++ b/xml/tests/src/com/intellij/codeInsight/daemon/XmlSimpleHighlightingTest.java @@ -8,9 +8,25 @@ import com.intellij.xml.util.CheckXmlFileWithXercesValidatorInspection; public class XmlSimpleHighlightingTest extends LightPlatformCodeInsightFixtureTestCase { public void testCannotFindDeclaration() { + checkValidation("\n" + + ""); + } + + public void testUnsupportedIncludeScheme() { + checkValidation("\n" + + " \n" + + ""); + } + + public void testSupportedIncludeScheme() { + checkValidation("\n" + + " <xi:include href=\"extensionPoints.xml\" xpointer=\"element(/1111)\"/>\n" + + ""); + } + + private void checkValidation(String text) { myFixture.enableInspections(CheckXmlFileWithXercesValidatorInspection.class); - myFixture.configureByText(XmlFileType.INSTANCE, "\n" + - ""); + myFixture.configureByText(XmlFileType.INSTANCE, text); myFixture.testHighlighting(); } } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/ExternalDocumentValidator.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/ExternalDocumentValidator.java index ecc290c7e38e..af25d1dca232 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/ExternalDocumentValidator.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/ExternalDocumentValidator.java @@ -127,6 +127,8 @@ public class ExternalDocumentValidator { }; myHandler.setErrorReporter(new ErrorReporter(myHandler) { + + int unsupportedSchemeAt = -1; @Override public boolean isStopOnUndeclaredResource() { return true; @@ -159,7 +161,7 @@ public class ExternalDocumentValidator { if (elementText.equals("") || elementText.equals("=")) { + else if (elementText.equals(">") || elementText.equals("/>") || elementText.equals("=")) { currentElement = currentElement.getPrevSibling(); } @@ -180,7 +182,15 @@ public class ExternalDocumentValidator { // "Cannot find the declaration of element" is not helpful without schema return; } + } else if ("SchemeUnsupported".equals(messageId)) { + unsupportedSchemeAt = offset; + return; + } else if (unsupportedSchemeAt == offset && + ("An 'include' failed, and no 'fallback' element was found.".equals(localizedMessage) || + (e.getLocalizedMessage().startsWith("Include operation failed, reverting to fallback.")))) { + return; } + if (localizedMessage.startsWith(CANNOT_FIND_DECLARATION_ERROR_PREFIX) || localizedMessage.startsWith(ELEMENT_ERROR_PREFIX) || localizedMessage.startsWith(ROOT_ELEMENT_ERROR_PREFIX) ||