}
private void setupEntities() {
List<String> namespaces = Lists.newArrayList(xmlWriterNamespaceManager
.getNamespaces());
Collections.sort(namespaces, new StringLengthComparator());
entities = new LinkedHashMap<>();
for (String curNamespace : namespaces) {
assert curNamespace != null;
String curPrefix = "";
if (xmlWriterNamespaceManager.getDefaultNamespace().equals(