# File lib/xml/util/xmlcanonicalizer.rb, line 130
        def canonicalize_element(element, logging = true)
                          logging=(true) if logging
                          @logger.debug("Canonicalize element:\n " + element.to_s()) if @logger
          @inclusive_namespaces = add_inclusive_namespaces(@prefix_list, element, @inclusive_namespaces) if (@prefix_list)
          @preserve_document = element.document()
          tmp_parent = element.parent()
          body_string = remove_whitespace(element.to_s().gsub("\n","").gsub("\t","").gsub("\r",""))
          document = Document.new(body_string)
          tmp_parent.delete_element(element)
          element = tmp_parent.add_element(document.root())
          @preserve_element = element
          document = Document.new(element.to_s())
          ns = element.namespace(element.prefix())
          document.root().add_namespace(element.prefix(), ns)
          write_document_node(document)
                         @logger.debug("Canonicalized result:\n " + @res.to_s()) if @logger
          @res
        end