XmlElementDescriptor (final QName qName, List<? extends DElementPattern> list) { int max = -1; DElementPattern maxPattern = null; for (DElementPattern pattern : list) { final NameClass nameClass = pattern.getName(); if (nameClass.contains(qName)) { final int spec = nameClass.containsSpecificity(qName); if (spec > max) { maxPattern = pattern; max = spec; } } } final List<DElementPattern> patterns = ContainerUtil.findAll(list, pattern -> { final NameClass nameClass = pattern.getName(); return nameClass.contains(qName); }); if (maxPattern != null) { if (patterns.size() > 1) { return initDescriptor(new CompositeDescriptor(this, maxPattern, patterns)); } else { return initDescriptor(new RngElementDescriptor(this, maxPattern)); } } else { return null; } }