Man*_*abu 4 .net c# xml asp.net
我想使用XML格式的C#在ASP.NET页面上显示我的数据
<person>
<email>a@a.com</email>
<dob>YYYY-MM-DD- HH:MM:SS</dob>
<city>XYZ</city>
</person>
Run Code Online (Sandbox Code Playgroud)
你有任何带有例子的代码吗?
在Html中格式化您的字符串
然后在那里添加值
加
Response.ClearHeaders();
Response.AddHeader("content-type", "text/xml");
Run Code Online (Sandbox Code Playgroud)
然后将字符串写入浏览器
response.write(yourstring);
Run Code Online (Sandbox Code Playgroud)
示例 -
string str = "<root>" + "<person>" + personName + "</person>";
str += "<details>";
str += "<DOB>" + "yyyy-MM-dd hh:mm:ss" + "</DOB>";
str += "<City> " + "XYZ" + "</City>";
str += "</details>";
str += "</root>";
Response.ClearHeaders();
Response.AddHeader("content-type", "text/xml");
Response.Write(str);
Response.End();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11818 次 |
| 最近记录: |