diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java index 2ff01ddec609..311ad08af0a9 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java +++ b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java @@ -240,7 +240,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { return null; } - private XmlNSDescriptor getNsDescriptorFormDocType(final XmlDoctype doctype, final XmlFile containingFile) { + XmlNSDescriptor getNsDescriptorFormDocType(final XmlDoctype doctype, final XmlFile containingFile) { XmlNSDescriptor descr = null; if (doctype.getMarkupDecl() != null){ descr = (XmlNSDescriptor)doctype.getMarkupDecl().getMetaData(); diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java index 66625c5ab7a7..01b18f589322 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java +++ b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java @@ -191,11 +191,12 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag { if (document == null) { return null; } - final String url = XmlUtil.getDtdUri(document); - if (url == null) { - return null; + + XmlDoctype docType = XmlUtil.getDocType(document); + if (document instanceof XmlDocumentImpl && docType != null) { + return ((XmlDocumentImpl)document).getNsDescriptorFormDocType(docType, containingFile); } - return document.getDefaultNSDescriptor(url, true); + return null; } public boolean isEmpty() { diff --git a/xml/impl/src/com/intellij/xml/util/XmlUtil.java b/xml/impl/src/com/intellij/xml/util/XmlUtil.java index de046a30687c..ffc9d0d56e7b 100644 --- a/xml/impl/src/com/intellij/xml/util/XmlUtil.java +++ b/xml/impl/src/com/intellij/xml/util/XmlUtil.java @@ -945,13 +945,13 @@ public class XmlUtil { @Nullable public static String getDtdUri(XmlDocument document) { - if (document.getProlog() != null) { - final XmlDoctype doctype = document.getProlog().getDoctype(); - if (doctype != null) { - return doctype.getDtdUri(); - } - } - return null; + XmlDoctype docType = getDocType(document); + return docType != null ? docType.getDtdUri() : null; + } + + public @Nullable static XmlDoctype getDocType(XmlDocument document) { + XmlProlog prolog = document.getProlog(); + return prolog != null ? prolog.getDoctype():null; } private static void computeTag(XmlTag tag,