Formatting XML with Nokogiri

What’s the best/recommended way to format XML with nokogiri?

I would like to be able to have all the nodes indented with a “\t”
instead of " " two spaces, and have max two attributes per line.

Do I have to use regular expressions on the xml string with gsub or is
there a better alternative?

Thanks,
Lance