The sub i'm currently using does an instr search for a unique string in an xml file. This works fine but i'd like to speed up the search if possible because I have a large number of xml files to search. My problem is that i have very little experience in parsing xml.
I notice that if i load the xml file and look at the namespaces i see item(1) through about item(20) and the unique string is always contained in one of those items. Note that the number of items can be different for each xml file i load.
The xml file is loaded into an object i define as oInstance and i'd like to do something like:
Do
counter = counter+1
if oInstance.namespaces.item(counter) = uniquestring then
DoThis
Exit Do
end if
Loop Until oInstance.namespaces.item(counter) Is Nothing
I tried basically that and it didn't work.
So I tried:
but now i get Err.Number 91
If anyone can point me in a direction to investigate I would appreciate it.
I notice that if i load the xml file and look at the namespaces i see item(1) through about item(20) and the unique string is always contained in one of those items. Note that the number of items can be different for each xml file i load.
The xml file is loaded into an object i define as oInstance and i'd like to do something like:
Do
counter = counter+1
if oInstance.namespaces.item(counter) = uniquestring then
DoThis
Exit Do
end if
Loop Until oInstance.namespaces.item(counter) Is Nothing
I tried basically that and it didn't work.
So I tried:
Code:
Dim COUNTERV2 As Integer
Dim oNodelistV2 As MSXML2.IXMLDOMNodeList
Set oNodelistV2 = oInstance.SelectNodes("namespaces")
COUNTERV2 = 0
Do
COUNTERV2 = COUNTERV2 + 1
If oNodelistV2.Item(COUNTERV2) = "http://fasb.org/us-gaap/2013-01-31" Then
m_strUSGAAP_TaxonomyVersion = "http://fasb.org/us-gaap/2013-01-31"
m_strInvest_TaxonomyVersion = "http://xbrl.sec.gov/invest/2013-01-31"
Exit Do
End If
Loop Until oNodelistV2.Item(COUNTER) Is Nothing
If anyone can point me in a direction to investigate I would appreciate it.