if (context.getInScopePrefix(qn.getNamespaceURI()) == null) {
String prefix = qn.getPrefix();
if (prefix == null || prefix.length() == 0)
{prefix = "";}
context.declareInScopeNamespace(prefix, qn.getNamespaceURI());
builder.namespaceNode(new QName(prefix, qn.getNamespaceURI(), "xmlns"));
}
} else if ((qn.getPrefix() == null || qn.getPrefix().length() == 0) &&
context.getInheritedNamespace("") != null) {
context.declareInScopeNamespace("", "");
builder.namespaceNode(new QName("", "", "xmlns"));