用dom生成XML文件的时候.里面的代码不换行,不会自动空格.

<reply author="xie" date="2005-12-12">ni hao</reply>
怎样才能让它自动换行和空格呢?