diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/XmlInspectionsTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/XmlInspectionsTest.java
index 9d1884e088ea..3451505b0aeb 100644
--- a/xml/tests/src/com/intellij/codeInsight/daemon/XmlInspectionsTest.java
+++ b/xml/tests/src/com/intellij/codeInsight/daemon/XmlInspectionsTest.java
@@ -19,8 +19,11 @@ import com.intellij.codeInsight.daemon.impl.analysis.XmlDefaultAttributeValueIns
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.ide.highlighter.HtmlFileType;
import com.intellij.ide.highlighter.XmlFileType;
+import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
+import java.io.File;
+
/**
* @author Dmitry Avdeev
*/
@@ -63,4 +66,14 @@ public class XmlInspectionsTest extends LightPlatformCodeInsightFixtureTestCase
myFixture.configureByText(HtmlFileType.INSTANCE, "");
myFixture.checkHighlighting();
}
+
+ public void testRequiredFixedAttribute() {
+ myFixture.enableInspections(new XmlDefaultAttributeValueInspection());
+ myFixture.testHighlighting("def.xml", "def.xsd");
+ }
+
+ @Override
+ protected String getTestDataPath() {
+ return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/xml";
+ }
}
diff --git a/xml/tests/testData/xml/def.xml b/xml/tests/testData/xml/def.xml
new file mode 100644
index 000000000000..3793ef8b953e
--- /dev/null
+++ b/xml/tests/testData/xml/def.xml
@@ -0,0 +1 @@
+"foo"/>
\ No newline at end of file
diff --git a/xml/tests/testData/xml/def.xsd b/xml/tests/testData/xml/def.xsd
new file mode 100644
index 000000000000..e10de914c05a
--- /dev/null
+++ b/xml/tests/testData/xml/def.xsd
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlDefaultAttributeValueInspection.java b/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlDefaultAttributeValueInspection.java
index 013e854035ed..f54342306459 100644
--- a/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlDefaultAttributeValueInspection.java
+++ b/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlDefaultAttributeValueInspection.java
@@ -46,7 +46,7 @@ public class XmlDefaultAttributeValueInspection extends XmlSuppressableInspectio
}
if (parent.getParent() instanceof HtmlTag) return;
XmlAttributeDescriptor descriptor = ((XmlAttribute)parent).getDescriptor();
- if (descriptor == null) {
+ if (descriptor == null || descriptor.isRequired()) {
return;
}
String defaultValue = descriptor.getDefaultValue();