Collection<Html5SectionTreeElement> (@NotNull final TreeElement node) { if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList(); final XmlFile xmlFile = ((HtmlFileTreeElement)node).getElement(); final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument(); if (document == null) return Collections.emptyList(); final List<XmlTag> rootTags = new ArrayList<>(); document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document); final Collection<Html5SectionTreeElement> result = new ArrayList<>(); for (XmlTag tag : rootTags) { result.addAll(Html5SectionsProcessor.processAndGetRootSections(tag)); } return result; }