为什么要用 dom 呢?
直接字符串拼装不就可以的吗?如$ar = array(
  array(
    'id' => 1,
    'user' => array('user_id' => 1, 'user_name' => '', 'user_pass' => 123, 'real_name' => 'aa'), 
    'title' => 1,
    'link' => 'http://www.xxx.com',
    'description' => 'id:1,user_name:,pass:123,real_name:aa',
  ),
  array(
    'id' => 2,
    'user' => array('user_id' => 2, 'user_name' => '', 'user_pass' => 456, 'real_name' => 'bb'), 
    'title' => 2,
    'link' => 'http://www.xxx.com',
    'description' => 'id:1,user_name:,pass:456,real_name:bb',
  ),
);<rss version="2.0">
<item id="1">
<id>1</id>
<user user_id="1" user_name="" user_pass="123" real_name="aa">
<title>1</title>
<link>http://www.xxx.com</link>
<description>id:1,user_name:,pass:123,real_name:aa</description>
</item>
<item id="2">
<id>2</id>
<user user_id="2" user_name="" user_pass="456" real_name="bb">
<title>2</title>
<link>http://www.xxx.com</link>
<description>id:1,user_name:,pass:456,real_name:bb</description>
</item>