use of com.intellij.psi.xml.XmlMarkupDecl in project intellij-community by JetBrains.
the class DtdResolveUtil method getNsDescriptor.
@Nullable
static XmlNSDescriptor getNsDescriptor(XmlElement element) {
final XmlElement parentThatProvidesMetaData = PsiTreeUtil.getParentOfType(CompletionUtilCoreImpl.getOriginalElement(element), XmlDocument.class, XmlMarkupDecl.class);
if (parentThatProvidesMetaData instanceof XmlDocument) {
final XmlDocument document = (XmlDocument) parentThatProvidesMetaData;
XmlNSDescriptor rootTagNSDescriptor = document.getRootTagNSDescriptor();
if (rootTagNSDescriptor == null)
rootTagNSDescriptor = (XmlNSDescriptor) document.getMetaData();
return rootTagNSDescriptor;
} else if (parentThatProvidesMetaData instanceof XmlMarkupDecl) {
final XmlMarkupDecl markupDecl = (XmlMarkupDecl) parentThatProvidesMetaData;
final PsiMetaData psiMetaData = markupDecl.getMetaData();
if (psiMetaData instanceof XmlNSDescriptor) {
return (XmlNSDescriptor) psiMetaData;
}
}
return null;
}
Aggregations