XmlToken (@NotNull XmlTag tag) { final ASTNode node = tag.getNode(); if (node == null) return null; ASTNode current = node.getFirstChildNode(); IElementType elementType; while (current != null && (elementType = current.getElementType()) != XmlTokenType.XML_NAME && elementType != XmlTokenType.XML_TAG_NAME) { current = current.getTreeNext(); } return current == null ? null : (XmlToken)current.getPsi(); }