From e52d6d4c05dac5d0fce07316dd73dbca2cd780cd Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 11 Oct 2018 19:26:55 +0300 Subject: [PATCH] IDEA-199839 Support deprecation in xsd schemas fixed schema prefix issue --- xml/tests/testData/xml/deprecated.xsd | 44 +++++++++---------- .../XmlDeprecatedElementInspection.java | 4 +- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/xml/tests/testData/xml/deprecated.xsd b/xml/tests/testData/xml/deprecated.xsd index db5f12446e8c..7c21590ef1d4 100644 --- a/xml/tests/testData/xml/deprecated.xsd +++ b/xml/tests/testData/xml/deprecated.xsd @@ -1,25 +1,25 @@ - - - - + + + + - - - - Some doc - deprecated - - - - - + + + + Some doc + deprecated + + + + + - - - - + + + + - - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlDeprecatedElementInspection.java b/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlDeprecatedElementInspection.java index ffea24d90f57..a68879ff34ec 100644 --- a/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlDeprecatedElementInspection.java +++ b/xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlDeprecatedElementInspection.java @@ -10,6 +10,7 @@ import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.XmlElementVisitor; import com.intellij.psi.meta.PsiMetaData; import com.intellij.psi.xml.*; +import com.intellij.util.ArrayUtil; import com.intellij.xml.util.XmlUtil; import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NotNull; @@ -59,7 +60,8 @@ public class XmlDeprecatedElementInspection extends XmlSuppressableInspectionToo if (!(declaration instanceof XmlTag)) return false; XmlComment comment = XmlUtil.findPreviousComment(declaration); if (comment != null && pattern.matcher(comment.getCommentText().trim()).matches()) return true; - return checkTag(((XmlTag)declaration).findFirstSubTag("annotation"), pattern); + XmlTag tag = (XmlTag)declaration; + return checkTag(ArrayUtil.getFirstElement(tag.findSubTags("annotation", tag.getNamespace())), pattern); } private static boolean checkTag(XmlTag tag, Pattern pattern) {