将数据集写入xml,包括额外的标记或元素. [英] Writing a Dataset to xml including extra tag or element.

查看:58
本文介绍了将数据集写入xml,包括额外的标记或元素.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,当我从数据集中生成xml时,会得到以下信息:

Currently when I produce an xml from a dataset I get this:

<?xml version ="1.0" encoding ="utf-8"?>
 < stockLocations>
   < stockLocation>

<?xml version="1.0" encoding="utf-8"?>
 <stockLocations>
   <stockLocation>

但是我需要的是:

<?xml version ="1.0" encoding ="utf-8"?>
< mad xmlns:xsi =" http://www.w3.org /2001/XMLSchema-instance " Xsi:noNamespaceSchemaLocation ="mad.xsd";版本="1.0" xmlns:Xsi ="xsi">
 < stockLocations>
   < stockLocation>

<?xml version="1.0" encoding="utf-8"?>
<mad xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Xsi:noNamespaceSchemaLocation="mad.xsd" version="1.0" xmlns:Xsi="xsi">
 <stockLocations>
   <stockLocation>

我将BOLD行作为WriteXml或数据集的一部分插入.

I do I insert the BOLD line as part of the WriteXml or Dataset.

推荐答案

尝试一下

            ds.WriteXml("filename", XmlWriteMode.WriteSchema);



这篇关于将数据集写入xml,包括额外的标记或元素.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆