DATASET输出XML

yl_588888 2003-07-16 10:27:36
我将DATASET的数据输出成XML形式,如何将部分字段和对应的值作为节点的属性输出
...全文
43 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaomimamaya 2003-07-18
  • 打赏
  • 举报
回复
DataSet.WriteXml(Schema)
zhangfanfan 2003-07-17
  • 打赏
  • 举报
回复
那就要自己写程序去转换了,把节点类型转化为属性类型
yl_588888 2003-07-17
  • 打赏
  • 举报
回复
这是不做处理调用WRITEXML方法的效果
<Customers>
<年份>2001</年份>
<建筑业>6462</建筑业>
</Customers>
本人需要的效果是
<Customers 年份=2001>
<建筑业>6462</建筑业>
</Customers>
各位兄弟看清要求,请指教
雪狼1234567 2003-07-16
  • 打赏
  • 举报
回复

// Set the file path and name. Modify this for your purposes.
string filename="mySchema.xml";
// Create a FileStream object with the file path and name.
System.IO.FileStream myFileStream = new System.IO.FileStream
(filename,System.IO.FileMode.Create);
// Create a new XmlTextWriter object with the FileStream.
System.Xml.XmlTextWriter MyXmlTextWriter =
new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
// Write the schema into the DataSet and close the reader.
thisDataSet.WriteXmlSchema(MyXmlTextWriter );
MyXmlTextWriter.Close();
yl_588888 2003-07-16
  • 打赏
  • 举报
回复
我不需要逐个输出的方式,有没有通过设置后,调用WRITEXML之类的方法直接生成的手段

111,125

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧