我编写了如下代码
$drawingCollection = $workBook->getActiveSheet()->getDrawingCollection(); foreach ($drawingCollection as $key => $drawing) { $drawingCollection->offsetUnset($key); }
这里的xmlString我在下面
Dim xNode As XmlNode
xNode = proclaimService.ProClaim_Get_Exclusions(sSQL)
XmlData = New StringReader(xNode.OuterXml)
Dim xmlString As String
xmlString = xNode.OuterXml
我使用下面的代码创建数据集
<NewDataSet xmlns=""> <Table> <company /> <Policy>10163067</Policy> <Rec_ty>Ex</Rec_ty> <Seq_no xml:space="preserve"></Seq_no> <Dt_last_updt>Dec 3 2003</Dt_last_updt> <Coverage_no>All</Coverage_no> <Client_no>65083406</Client_no> <Document_name>Exclusion</Document_name> <Print_ind /> <Retention_ind /> <Exclusion_type>Exclu</Exclusion_type> <Comment01>blessure,maladie ou trouble d'un ou des deux genoux, y compr</Comment01> <comment02>is les complications, traitements ou chirurgies connexes.</comment02> <comment03 xml:space="preserve"></comment03> <comment04 xml:space="preserve"></comment04> <comment05 xml:space="preserve"></comment05> <comment06 xml:space="preserve"></comment06> <comment07 xml:space="preserve"></comment07> <comment08 xml:space="preserve"></comment08> <comment09 xml:space="preserve"></comment09> <comment10 xml:space="preserve"></comment10> </Table> </NewDataSet>
但是在XmlData中我没有得到任何东西..... 如何使用VB.NET将其转换为数据集???
答案 0 :(得分:1)
如果没有更多信息,很难知道如何回答。这是一个适用于文件的示例。请注意评论。
Dim xmlStrm As New IO.StreamReader(pathToFile)
'xmlStrm could be a .GetResponseStream from a web response
'Dim xmlStrm As IO.Stream = someWebResp.GetResponseStream
Dim Dset As New DataSet
Using reader As Xml.XmlReader = Xml.XmlReader.Create(xmlStrm)
Dset.ReadXml(reader)
End Using
xmlStrm.Close()
xmlStrm.Dispose()
Debug.WriteLine(Dset.Tables.Count)
For Each rw As DataRow In Dset.Tables(0).Rows
'as example show first two columns
Debug.WriteLine(rw(0).ToString & " " & rw(1).ToString)
Next
编辑:从返回XML的网站
Dim someReq As Net.WebRequest = Net.WebRequest.Create(someURL)
Dim someResp As Net.WebResponse = someReq.GetResponse()
Dim someStrm As IO.Stream = someResp.GetResponseStream()
Dim someDoc As New Xml.XmlDocument
someDoc.Load(someStrm)
Dim xe As XElement = XElement.Parse(someDoc.InnerXml)
Dim Dset As New DataSet
Using reader As Xml.XmlReader = xe.CreateReader
Dset.ReadXml(reader)
End Using
Debug.WriteLine(Dset.Tables.Count)