First, I'm very inexperienced in parsing XML and I'm using someone else's code (who isn't available for help) at the moment to accomplish a task while I learn how the code works.
For most of my task the code works fine but in a few instances it doesn't and I can't identify why.
I'm loading a document using the following for one particular case.
Then I'm using this to extract info from the xml:
As I step through the code I see that oNodelist.Length = 0 so the GetBalShtAndIncStmtData sub is not executed and that's ultimately why I'm not getting data.
But if I open the XML page in a browser and search for the number that the code above is supposed to find (6857000000), I see that it is there (in two places, the second instance is the one that should satisfy the code above).
Given my inexperience with XML I've been unable to troubleshoot this so far. Any ideas or references are greatly appreciated.
For most of my task the code works fine but in a few instances it doesn't and I can't identify why.
I'm loading a document using the following for one particular case.
Code:
Private Sub LoadInstanceDocIntoMemory()
Set oInstance = New MSXML2.DOMDocument60
oInstance.async = False
oInstance.validateOnParse = False
oInstance.Load "http://www.sec.gov/Archives/edgar/data/1111335/000111133513000004/vc-20121231.xml"
If oInstance.parseError.ErrorCode <> 0 Then
PARSE_ERROR_CODE = oInstance.parseError.ErrorCode
End If
End Sub
Then I'm using this to extract info from the xml:
Code:
Set oNodelist = oInstance.SelectNodes("//us-gaap:SalesRevenueGoodsNet[@contextRef='D2012Q4YTD']")
If oNodelist.Length > 0 Then
GetBalShtAndIncStmtData = oInstance.SelectSingleNode("//us-gaap:SalesRevenueGoodsNet[@contextRef='D2012Q4YTD']").Text
End If
As I step through the code I see that oNodelist.Length = 0 so the GetBalShtAndIncStmtData sub is not executed and that's ultimately why I'm not getting data.
But if I open the XML page in a browser and search for the number that the code above is supposed to find (6857000000), I see that it is there (in two places, the second instance is the one that should satisfy the code above).
Given my inexperience with XML I've been unable to troubleshoot this so far. Any ideas or references are greatly appreciated.