XmlElementDescriptor (XmlTag element, XmlTag contextTag) { String name = toLowerCaseIfNeeded(element.getName()); XmlElementDescriptor xmlElementDescriptor = getElementDescriptor(name, contextTag); if (xmlElementDescriptor == null && "html".equals(getName())) { XmlTag head = null; XmlTag body = null; for (XmlTag child : PsiTreeUtil.getChildrenOfTypeAsList(contextTag, XmlTag.class)) { if ("head".equals(child.getName())) head = child; if ("body".equals(child.getName())) body = child; } if (head == null) { if (body == null || element.getTextOffset() < body.getTextOffset()) { XmlElementDescriptor headDescriptor = getElementDescriptor("head", contextTag); if (headDescriptor != null) { xmlElementDescriptor = headDescriptor.getElementDescriptor(element, contextTag); } } } if (xmlElementDescriptor == null && body == null) { XmlElementDescriptor bodyDescriptor = getElementDescriptor("body", contextTag); if (bodyDescriptor != null) { xmlElementDescriptor = bodyDescriptor.getElementDescriptor(element, contextTag); } } } if (xmlElementDescriptor == null && myRelaxed) { xmlElementDescriptor = RelaxedHtmlFromSchemaElementDescriptor.getRelaxedDescriptor(this, element); } return xmlElementDescriptor; }