Collection<StructureViewTreeElement> () { if (isHtml5SectionsMode()) { return Collections.emptyList(); // Html5SectionsNodeProvider will return its structure } final XmlFile xmlFile = getElement(); final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument(); if (document == null) { return Collections.emptyList(); } final List<XmlTag> rootTags = new SmartList<>(); document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document); if (rootTags.isEmpty()) { return Collections.emptyList(); } else if (rootTags.size() == 1) { final XmlTag rootTag = rootTags.get(0); if ("html".equalsIgnoreCase(rootTag.getLocalName())) { final XmlTag[] subTags = rootTag.getSubTags(); if (subTags.length == 1 && ("head".equalsIgnoreCase(subTags[0].getLocalName()) || "body".equalsIgnoreCase(subTags[0].getLocalName()))) { return new HtmlTagTreeElement(subTags[0]).getChildrenBase(); } return new HtmlTagTreeElement(rootTag).getChildrenBase(); } return Collections.singletonList(new HtmlTagTreeElement(rootTag)); } else { final Collection<StructureViewTreeElement> result = new ArrayList<>(rootTags.size()); for (XmlTag tag : rootTags) { result.add(new HtmlTagTreeElement(tag)); } return result; } }