XsdNamespaceBuilder (@NotNull Reader reader) { try (reader) { XsdNamespaceBuilder xsdBuilder = new XsdNamespaceBuilder(); NanoXmlBuilder builder = xsdBuilder.new NanoBuilder(); NanoXmlUtil.parse(reader, builder); HashSet<String> tags = new HashSet<>(xsdBuilder.getTags()); tags.removeAll(xsdBuilder.myReferencedTags); xsdBuilder.getRootTags().addAll(tags); return xsdBuilder; } catch (IOException e) { // can never happen throw new RuntimeException(e); } }