如何从类型化数据集中将架构信息添加到xmldocument中 [英] How to add schema information into xmldocument from typed dataset

查看:78
本文介绍了如何从类型化数据集中将架构信息添加到xmldocument中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在尝试返回从键入的

数据集转换的XmlDocument或XmlNode。


public XmlNode whatever(){

MyTypedDataSet ds = new MyTypedDataSet();

返回新的XmlDataDocument(ds);

}


在WSDL中,它将返回的类型显示为xml;在结果中,它显示了xml

数据。


如何在两个地方放置架构信息?


谢谢。

Hi,

I''m trying to return an XmlDocument or XmlNode converted from a typed
dataset.

public XmlNode whatever() {
MyTypedDataSet ds = new MyTypedDataSet();
return new XmlDataDocument(ds);
}

In WSDL, it shows returned type as xml; in the result, it shows the xml
data.

How do I put schema information in both places?

Thanks.

推荐答案

您不必将所有XML都放在一个XML文档中。


您可以先使用模式加载DataSet:

dataset.ReadXMLSchema(xmlSchemaNode)

然后读取来自不同节点的数据:

dataset.ReadXML(xmlDataNode)


请务必先阅读架构。

Whoever < BZ **** @ hotmail.com>在留言中写道

新闻:ew ************* @ TK2MSFTNGP11.phx.gbl ...
You don''t have to have all the XML in one XML document.

You can first load up the DataSet with the schema:
dataset.ReadXMLSchema(xmlSchemaNode)
and then read in the data from a different node:
dataset.ReadXML(xmlDataNode)

Be sure to read the schema in first though.
"Whoever" <bz****@hotmail.com> wrote in message
news:ew*************@TK2MSFTNGP11.phx.gbl...


我正在尝试返回从类型化的
数据集转换的XmlDocument或XmlNode。

public XmlNode whatever(){
MyTypedDataSet ds = new MyTypedDataSet() ;
返回新的XmlDataDocument(ds);


在WSDL中,它将返回的类型显示为xml;在结果中,它显示了xml
数据。

如何在两个地方放置架构信息?

谢谢。
Hi,

I''m trying to return an XmlDocument or XmlNode converted from a typed
dataset.

public XmlNode whatever() {
MyTypedDataSet ds = new MyTypedDataSet();
return new XmlDataDocument(ds);
}

In WSDL, it shows returned type as xml; in the result, it shows the xml
data.

How do I put schema information in both places?

Thanks.



感谢您的回复。我不是想读,而是写。我已经在数据集中有

数据并试图从网络服务返回它当然是

xmldocument。


看到那里有一个ds.WriteXml(????,XmlWriteMode.WriteSchema)


但是我能找到的所有例子都试图写入文件。我需要将

写入XmlNode / XmlDocument / XmlDataDocument并返回它。


当然,最好在WSDL中获取模式信息还有。


有什么想法吗?

" Scott M." < S - *** @ nospam.nospam>在留言中写道

新闻:e7 ************** @ tk2msftngp13.phx.gbl ...
Thanks for the reply. I''m not try to read, but to write. I already have
data in the dataset and trying to return it from a web service as
xmldocument of course.

Just saw there''s a ds.WriteXml(????, XmlWriteMode.WriteSchema)

But all examples I can find are trying to write to a file. I need to write
into an XmlNode/XmlDocument/XmlDataDocument and return it.

Of course, it''s better to have the schema information in WSDL as well.

Any ideas?
"Scott M." <s-***@nospam.nospam> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
你不要必须在一个XML文档中包含所有XML。

您可以先使用模式加载DataSet:
dataset.ReadXMLSchema(xmlSchemaNode)
然后读入数据来自不同的节点:
dataset.ReadXML(xmlDataNode)

请务必先阅读架构。

Whoever < BZ **** @ hotmail.com>在消息中写道
新闻:ew ************* @ TK2MSFTNGP11.phx.gbl ...
You don''t have to have all the XML in one XML document.

You can first load up the DataSet with the schema:
dataset.ReadXMLSchema(xmlSchemaNode)
and then read in the data from a different node:
dataset.ReadXML(xmlDataNode)

Be sure to read the schema in first though.
"Whoever" <bz****@hotmail.com> wrote in message
news:ew*************@TK2MSFTNGP11.phx.gbl...


我正在尝试返回从类型化的
数据集转换的XmlDocument或XmlNode。

public XmlNode whatever(){
MyTypedDataSet ds = new MyTypedDataSet();
返回新的XmlDataDocument(ds);


在WSDL中,它将返回的类型显示为xml;在结果中,它显示了xml
数据。

如何在两个地方放置架构信息?

谢谢。
Hi,

I''m trying to return an XmlDocument or XmlNode converted from a typed
dataset.

public XmlNode whatever() {
MyTypedDataSet ds = new MyTypedDataSet();
return new XmlDataDocument(ds);
}

In WSDL, it shows returned type as xml; in the result, it shows the xml
data.

How do I put schema information in both places?

Thanks.




DataSet上的WriteXml方法允许您写入字符串或

流。
http://msdn.microsoft .com / library / en ... teXmlTopic.asp


您无需写入文件。


您也可以在数据集上调用GetXmlSchema方法,并将其放入

字符串。
http://msdn.microsoft.com/library/en...chematopic.asp


考虑使用2种方法 - 一种返回模式,另一种返回数据
。或者将它们放入不同的XmlDocuments中。


-Dino


Whoever < BZ **** @ hotmail.com>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP12.phx.gbl ...
The WriteXml method on the DataSet allows you to write to a string or to a
stream.
http://msdn.microsoft.com/library/en...teXmlTopic.asp

You do not need to write to a file.

You can also call GetXmlSchema method on the dataset, and put that into a
string.
http://msdn.microsoft.com/library/en...chematopic.asp

Consider using 2 methods - one that returns the schema and one that returns
the data. Either that or put them into different XmlDocuments.

-Dino

"Whoever" <bz****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
谢谢你答复。我不是想读,而是写。我已经在数据集中有数据并试图从Web服务返回它当然是
xmldocument。

刚看到那里有一个ds.WriteXml(??? ?,XmlWriteMode.WriteSchema)

但是我能找到的所有例子都试图写入文件。我需要将
写入XmlNode / XmlDocument / XmlDataDocument并返回它。

当然,在WSDL中获取模式信息也是更好的。

任何想法?

" Scott M." < S - *** @ nospam.nospam>在消息中写道
新闻:e7 ************** @ tk2msftngp13.phx.gbl ...
Thanks for the reply. I''m not try to read, but to write. I already have
data in the dataset and trying to return it from a web service as
xmldocument of course.

Just saw there''s a ds.WriteXml(????, XmlWriteMode.WriteSchema)

But all examples I can find are trying to write to a file. I need to
write
into an XmlNode/XmlDocument/XmlDataDocument and return it.

Of course, it''s better to have the schema information in WSDL as well.

Any ideas?
"Scott M." <s-***@nospam.nospam> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
你没有必要全部一个XML文档中的XML。

您可以先使用模式加载DataSet:
dataset.ReadXMLSchema(xmlSchemaNode)
然后读入来自不同节点的数据:
dataset.ReadXML(xmlDataNode)

请务必先阅读架构。

Whoever < BZ **** @ hotmail.com>在消息中写道
新闻:ew ************* @ TK2MSFTNGP11.phx.gbl ...
You don''t have to have all the XML in one XML document.

You can first load up the DataSet with the schema:
dataset.ReadXMLSchema(xmlSchemaNode)
and then read in the data from a different node:
dataset.ReadXML(xmlDataNode)

Be sure to read the schema in first though.
"Whoever" <bz****@hotmail.com> wrote in message
news:ew*************@TK2MSFTNGP11.phx.gbl...
>
>
>我正在尝试返回从键入的
>转换的XmlDocument或XmlNode。数据集。
>
> public XmlNode whatever(){
> MyTypedDataSet ds = new MyTypedDataSet();
>返回新的XmlDataDocument(ds);
> }
>
>在WSDL中,它将返回的类型显示为xml;在结果中,它显示了xml
>数据。
>
>如何在两个地方放置架构信息?
>
>谢谢。
>
>
> Hi,
>
> I''m trying to return an XmlDocument or XmlNode converted from a typed
> dataset.
>
> public XmlNode whatever() {
> MyTypedDataSet ds = new MyTypedDataSet();
> return new XmlDataDocument(ds);
> }
>
> In WSDL, it shows returned type as xml; in the result, it shows the xml
> data.
>
> How do I put schema information in both places?
>
> Thanks.
>
>





这篇关于如何从类型化数据集中将架构信息添加到xmldocument中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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