DataTable to XML - Compliancy问题 [英] DataTable to XML - Compliancy problem
问题描述
亲爱的朋友们,
我目前正在使用VS2008(3.5 SP1)来构建.NET Web服务。我正在使用包含DataTable和DataTableAdapter的类型化DataSet。我能够将所需的信息检索到类型化的DataTable(ClientDataTable)中。到现在为止还挺好。问题是我需要将类型化DataTable中的数据导出到XML。虽然我能够这样做,但我返回的XML包含.NET细节(IsDataSet = true等等)。我需要获取与WS-I Basic Profile 1.1兼容的XML,因为我的Web服务包含EmitConformanceClaims和ConformsTo属性。从本质上讲,XML需要尽可能不可知和可互操作,因为它将被不同的平台使用。我还需要它自我描述,因此我需要包含XML模式信息,以便Web服务使用者知道"客户端"是什么。是什么和"订单"是什么是;基本上是自我描述性的。我愿意使用LINQ,XMLWriters,XMLReaders等...
另外,我需要确保能够发出父子类型XML(Orders - > Order)。
有谁可以帮忙?
最诚挚的问候,
Giovanni
Hi GiovanniP,
如果要手动创建xml文件,则需要遍历数据表并逐行设置值。编写XML有两种选择:
1)LINQ to XML
http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx
http://msdn.microsoft.com/en-us/vbasic/bb688087.aspx
http://msdn.microsoft.com/en -us / vbasic / bb688087.aspx
2)DOM和SAX
< a href ="http://www.c-sharpcorner.com/uploadfile/mahesh/readwritexmltutmellli2111282005041517am/readwritexmltutmellli21.aspx"> http://www.c-sharpcorner.com/uploadfile/mahesh/readwritexmltutmellli2111282005041517am/readwritexmltutmellli21.aspx 一>
由于您的问题与创建XML文件有关,您可以在XML论坛中发帖以获得更好的支持。
< a href ="http://social.msdn.microsoft.com/Forums/en-US/xmlandnetfx/threads"> http://social.msdn.microsoft.com/Forums/en-US/xmlandnetfx/threads
最好的问候
Yichun Feng
Dear Friends,
I am currently using VS2008 (3.5 SP1) to build a .NET Web Service. I am using a typed DataSet which contains a DataTable and a DataTableAdapter. I am able to retrieve the information I need into a typed DataTable (ClientDataTable). So far, so good. The problem is that I need to export the data in the typed DataTable to XML. While I am able to do this, I am returned XML which contains .NET specifics (IsDataSet = true, etc...). I need to obtain ONLY the XML which is WS-I Basic Profile 1.1 compliant as my Web Service contains the EmitConformanceClaims and ConformsTo attributes. In essence, the XML needs to be as agnostic and interoperable as possible as it will be used by differnet platforms. I also need it to be self-describing so I need to include XML schema information so web service consumers know what a "Client" is and what an "Order" is; basically self-descriptive. I am open to using LINQ, XMLWriters, XMLReaders, etc...
In addition, I need to ensure that I am able to emit parent-child type XML (Orders -> Order).
Can anyone please help?
Best Regards,
Giovanni
Hi GiovanniP,
If you want to create the xml file manually, you need iterate through the datatable and set the value line by line. There are two options for writing XML:
1) LINQ to XML
http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx
http://msdn.microsoft.com/en-us/vbasic/bb688087.aspx
http://msdn.microsoft.com/en-us/vbasic/bb688087.aspx
2) DOM and SAX
As your issue related to create XML file, you can post in XML forum for better support.
http://social.msdn.microsoft.com/Forums/en-US/xmlandnetfx/threads
Best Regards
Yichun Feng
这篇关于DataTable to XML - Compliancy问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!