Set<QName> (Set<QName> _set) { final Set<QName> set = new HashSet<>(_set); for (Iterator<QName> it = set.iterator(); it.hasNext();) { final QName name = it.next(); final String prefix = name.getPrefix(); if (prefix == null || prefix.length() == 0) { final String uri = name.getNamespaceURI(); if (uri != null && uri.length() > 0) { final String assignedPrefix = myNamespaceContext.getPrefixForURI(uri, null); if (assignedPrefix == null) { it.remove(); } } } } return set; }