[VB6 ] 如何從xml抓取大量資料

看板Visual_Basic作者 (冠軍衫)時間19年前 (2006/07/17 15:15), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
以下是我寫的 當我讀取資料量只有40筆的資料,能夠很快就讀完寫出到txt上 不過我讀取有50000筆的資料量時,它執行的非常非常慢,兩天才寫到txt上30筆資料. 我主要的目的是要把xml的資料讀取並寫到txt上,好作為我以後的抓值. Private Sub Command1_Click() ' Load an xml document into a DOM instance. Dim oXMLDom As New DOMDocument30 oXMLDom.async = False oXMLDom.validateOnParse = False oXMLDom.resolveExternals = False oXMLDom.preserveWhiteSpace = True If oXMLDom.Load(App.Path + "\Test_Sheet_Conditions1000.xml") = False Then MsgBox "Failed to load xml data from file." Exit Sub End If GoTo MoreNodes1 MoreNodes1: ' Query a node-set. Dim oNodes As IXMLDOMNodeList Dim temp(1000, 4) As String f1 = App.Path + "\data1.txt" Open f1 For Output As #1 For q = 0 To 999 Set oNodes = oXMLDom.selectNodes("//qmd_item[" + Trim(q) + "]/*") For i = 1 To oNodes.length Set oNode = oNodes.nextNode If Not (oNode Is Nothing) Then sName = oNode.nodeName sdata = oNode.Text temp(q + 1, i ) = sdata Print #1, temp(q + 1, i ) End If Next i Next q Close #1 MsgBox "執行完成" End Sub -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.132.196.119
文章代碼(AID): #14kpZv8A (Visual_Basic)
文章代碼(AID): #14kpZv8A (Visual_Basic)