private void transferNamespaces(final Element element) {
    for (final Namespace ns : declaredNamespaces) {
      if (ns != element.getNamespace()) {
        element.addNamespaceDeclaration(ns);
      }
    }
    declaredNamespaces.clear();
  }
private void transferNamespaces(final Element element)