QName implements Comparable<QName> contract with the following logic:
public int compareTo(final QName o) { int result = getLocalName().compareTo(o.getLocalName()); if (result != 0) { return result; } return module.compareTo(o.module); }
this has very ugly implications, as QNames are grouped by their localName first and then by their namespace.
This is counter-intuitive as namespace is really what is grouping concerns, hence we should keep things in the namespace neatly together.