日期:2014-05-16  浏览次数:20342 次

xml文件问题
XML code

<req><chatRoom><id>wwww</id><cname>ddddd</cname><ctype>1</ctype><maxUsers>500</maxUsers><welcomes>ssss</welcomes><description>qqqq</description><status>1</status><startTime>tttt</startTime><closeTime>rrrrrr</closeTime><createTime>Thu Oct 11 14:19:47 UTC+0800 2012</createTime></chatRoom></req>


我想在req后面加上一些参数,这个怎么弄,请教高手
XML code

<req id="sample"><chatRoom><id>wwww</id><cname>ddddd</cname><ctype>1</ctype><maxUsers>500</maxUsers><welcomes>ssss</welcomes><description>qqqq</description><status>1</status><startTime>tttt</startTime><closeTime>rrrrrr</closeTime><createTime>Thu Oct 11 14:19:47 UTC+0800 2012</createTime></chatRoom></req>



------解决方案--------------------
replace(/<req>/g,'<req id="sample">')