通过Sql语句直接返回XML文件
select UserID,UserName,AccountName,LoginPassword from users for xml raw('Users') ,root ('User') --Users为子节点名称 User为根节点名称
生产文件格式如下
<User> <Users UserID="88103" UserName="Manager" AccountName="adminManager" LoginPassword="123456" /> <Users UserID="88104" UserName="Manager1" AccountName="Manager1" LoginPassword="123456" /> <Users UserID="88569" UserName="鄢树岭" AccountName="yansl@nmg" LoginPassword="11111111" /> <Users UserID="88570" UserName="塔娜" AccountName="tan_dcs@nmg" LoginPassword="11111111" /> <Users UserID="88571" UserName="鹿传深" AccountName="lucs@nmg" LoginPassword="11111111" /> <Users UserID="88572" UserName="钱英" AccountName="qiany_lgb@nmg" LoginPassword="11111111" /> <Users UserID="88573" UserName="陈旭呈" AccountName="chenxc@nmg" LoginPassword="11111111" /> </User>