c#中带头(声明)的xml(封装)生成
程序员文章站
2024-03-08 23:23:28
复制代码 代码如下: xmldocument downloadfilexml = new xmldocument(); xmlelement root = null; xm...
复制代码 代码如下:
xmldocument downloadfilexml = new xmldocument();
xmlelement root = null;
xmlelement kisokchild = null;
//生成xml的头
xmlnode xmlnode= downloadfilexml.createxmldeclaration("1.0", "utf-8", null);
downloadfilexml.appendchild(xmlnode);
root = downloadfilexml.createelement("test");
root.setattribute("guid",“1”);
root.setattribute("buildid","0");
downloadfilexml.appendchild(root);
kisokchild = downloadfilexml.createelement("testchild");
kisokchild.setattribute("interval","111");
root.appendchild(kisokchild);
response.write(downloadfilexml.outerxml);
response.end();
上一篇: HCIE第六天总结
推荐阅读