XmlTag[] (@NotNull XmlTag rootTag, final @Nullable String xpointer) { if (xpointer != null) { Matcher matcher = JDOMUtil.XPOINTER_PATTERN.matcher(xpointer); if (matcher.matches()) { String pointer = matcher.group(1); matcher = JDOMUtil.CHILDREN_PATTERN.matcher(pointer); if (matcher.matches() && matcher.group(1).equals(rootTag.getName())) { XmlTag[] tags = rootTag.getSubTags(); String subTagName = matcher.group(2); if (subTagName == null) return tags; XmlTag subTag = ContainerUtil.find(tags, t -> subTagName.substring(1).equals(t.getName())); return subTag == null ? XmlTag.EMPTY : subTag.getSubTags(); } } } return new XmlTag[]{rootTag}; }