Hello,
I have a code with which I can parse a file of around 1MB. However I am looking to parse an xml file of about 128MB.
Below is my code -
Dim xml_doc As New DOMDocument
-
Dim brtn As Boolean
-
-
Dim xnode As IXMLDOMElement
-
Dim snode As IXMLDOMElement
-
-
Dim intr As Long
-
Dim tmp As Long
-
-
-
-
Sheet1.Cells.Clear
-
-
'
-
file = Application.GetOpenFilename("Choose xml File (*.xml*),*.*", , "Openxml File")
-
brtn = xml_doc.Load(file)
-
-
intr = 2
-
tmp = 2
-
-
Sheet1.Cells.ClearFormats
-
-
If brtn Then
-
-
With Sheets("Sheet1")
-
.Cells(1, 1) = "Node"
-
.Cells(1, 2) = "Version"
-
.Cells(1, 3) = "distName"
-
.Cells(1, 4) = "ID"
-
.Cells(1, 5) = "Managed Object"
-
.Cells(1, 6) = "Value"
-
-
-
-
Range("A1", "F1").Font.Bold = True
-
Sheet1.Range("A1", "F1").HorizontalAlignment = xlCenter
-
-
-
-
-
For Each snode In xml_doc.SelectNodes("//managedObject")
-
-
For Each xnode In snode.ChildNodes
-
-
-
-
-
.Cells(intr, 1) = snode.getAttribute("class")
-
.Cells(intr, 2) = snode.getAttribute("version")
-
.Cells(intr, 3) = snode.getAttribute("distName")
-
.Cells(intr, 4) = snode.getAttribute("id")
-
.Cells(intr, 5) = xnode.getAttribute("name")
-
.Cells(intr, 6) = xnode.Text
-
-
-
intr = intr + 1
-
-
Next
-
-
Next
-
-
-
-
-
-
End With
-
Else
-
MsgBox "Unable to open xml file...."
-
-
End If
-
EndParse:
-
End Sub
Please let me know if there is any possible way to load around 250000 elements.
I read in some other article that DOM loads the whole file before parsing. The file size is more than 128 MB so my PC gets hang before showing result in the excel file.
It also read SAX is the efficient method. So I am not sure which one to use SAX or an array or stream all elements one by one?
Thank you
Chins
0 2947 Sign in to post your reply or Sign up for a free account.
Similar topics
by: liming |
last post by:
Hi all,
I have to parse two text files on a weekly basis. Each range from 300kb to
1mb in total. Each text file has 5 columns (name,id, dollar,
startdate,enddate), everytime,
a) I need to...
|
by: AdrianH |
last post by:
Assumptions
I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming.
FYI
Although I have called...
|
by: AdrianH |
last post by:
Assumptions
I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming.
FYI
Although I have called this...
|
by: bebek_tetangga |
last post by:
Hello, I'm trying to open a .txt file in Excel using C#. Here is my
code:
clsWorkbook = clsExcel.Workbooks.Open(dailyPath + "\\070701N.txt", 2,
false, 5, "", "", true,...
|
by: CoolFactor |
last post by:
MY CODE IS NEAR THE BOTTOM
I want to export this Access query into Excel using a command button on an Access form in the following way I describe below.
Below you will find the simple query I am...
|
by: wankhusairi |
last post by:
hallo sir .. i am still new on using vb and i have tried to load an excel using a visual basic interface.. but if i wanted to plot my excel data what should i do.. must i cahnge my program on loading...
|
by: =?Utf-8?B?YXNob2tuYW5kaA==?= |
last post by:
Hi,
I am using a native asp.net file upload technic which currently supports
small files. But i need to upload the file of size more than 200 mb to 300
mb.
I have used many 3rd party...
|
by: dodoG |
last post by:
Hello,
How to parse html file tags <h1>-<h4> to excel file with c#.
1. How i create excel 2007 object .
2. What should i do in visual studio 2005 (which references in com object).
3. How i...
|
by: zcabeli |
last post by:
hello,
i've got XML file which contain the following records as shown in example below.
<group name="ddd" >
<param name="abc" def="0xc" tag="1" encapsulated="1"
PATH...
|
by: =?Utf-8?B?RGF2aWRN?= |
last post by:
Hello, I have an XML file generated from a third party application that I
would like to parse. Ideally, I plan on having a windows service setup to
scan various folders for XML files and parse the...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |