用这种方法做,你可以自己定义数据格式:
public XmlDocument get_Branches()
{
XmlDocument xmldoc=new XmlDocument();
xmldoc.AppendChild(xmldoc.CreateProcessingInstruction("xml","version=\"1.0\""));
xmldoc.AppendChild(xmldoc.CreateElement("gxsti-news"));
XmlElement news=xmldoc.CreateElement("news");
xmldoc.DocumentElement.AppendChild(news); for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
XmlNode item=news.AppendChild(xmldoc.CreateElement("item"));
XmlNode Branchid=item.AppendChild(xmldoc.CreateElement("Branchid"));//机构编号
Branchid.InnerText="值"; XmlNode Branchname=item.AppendChild(xmldoc.CreateElement("Branchname"));//机构名称
Branchname.InnerText="值";
}
return xmldoc;
}
public XmlDocument get_Branches()
{
XmlDocument xmldoc=new XmlDocument();
xmldoc.AppendChild(xmldoc.CreateProcessingInstruction("xml","version=\"1.0\""));
xmldoc.AppendChild(xmldoc.CreateElement("gxsti-news"));
XmlElement news=xmldoc.CreateElement("news");
xmldoc.DocumentElement.AppendChild(news); for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
XmlNode item=news.AppendChild(xmldoc.CreateElement("item"));
XmlNode Branchid=item.AppendChild(xmldoc.CreateElement("Branchid"));//机构编号
Branchid.InnerText="值"; XmlNode Branchname=item.AppendChild(xmldoc.CreateElement("Branchname"));//机构名称
Branchname.InnerText="值";
}
return xmldoc;
}
解决方案 »
- 请问,asp.net2008下如何获取项目名称?
- 文本框值改变,触发按钮的enabled属性改变的问题
- 一个js题目:
- aspnetpager 性能怎么样?在线等
- asp.net与javascript定时不刷新弹出窗口的问题?
- 关于企业一般意义上的门户网站的问题。。。。
- 从XML文档到dataset再到datatable的过滤问题 求助
- 我想使用OpenFileDialog,但是老是出错,在线等!!
- SqlBulkCopy与Insert触发器
- 文章列表分2列显示
- 小弟是刚学习asp.net,请问各位可不可以对.aspx文件进行逐句运行,如何做?
- SharePoint 中如何设置Email Server?(不知道在哪问了)
可上面在最后一步强制类型转换时出错了。报什么错