long time reader, but first post on here. Any and all help is highly appreciated!
I am working on a data scraper to obtain our clients' market results from the grid operator, and require a series of xml queries to do so. I am able to connect, authenticate and receive a response to my query using SOAP schema (required by grid operator). However, when I try to load the xml string I receive from the server into a DOMDocument60 object using the LoadXML function, it strips all of the nodes from the response and results in an xml document with only the header in one node and a concatenation of all the values stored in all nodes of the string in a second node.
Hence, I cannot extract the values I need. They have varying lengths and I have no way of knowing when one value finishes and the next one starts. Additionally, because the node names have been stripped, when I try and obtain a node list of all nodes called "DSRSRREGAwardHourly" I get an empty list.
XML received from server after querying (I've left only one of the hourly nodes to simplify)
<?xml version='1.0' encoding='UTF-8'?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<QueryResponse xmlns="http://emkt.pjm.com/emkt/xml">
<DSRSRREGAwardSet>
<DSRSRREGAward day="2018-12-01" location="1960147390">
<DSRSRREGAwardHourly hour="1">
<SynchOfferMW>0.5</SynchOfferMW>
<RegOfferMW>0</RegOfferMW>
<SelfScheduledMW>0</SelfScheduledMW>
<SynchAwardedMW>0</SynchAwardedMW>
<RegAwardedMW>0</RegAwardedMW>
<RegOfferPriceUsed>0</RegOfferPriceUsed>
<RegdOfferMW>0</RegdOfferMW>
<RegdMW>0</RegdMW>
</DSRSRREGAwardHourly>
</DSRSRREGAward>
</DSRSRREGAwardSet>
</QueryResponse>
</Body>
</Envelope>
Relevant VBA code I'm using
'Variable definition
Dim oWinhttp As WinHttpRequest
Dim ReturnXML As MSXML2.DOMDocument60
Dim ItemList As IXMLDOMNodeList
Dim XMLItem As IXMLDOMNode
'Variable initialization
Set oWinhttp = New WinHttpRequest
Set ReturnXML = New MSXML2.DOMDocument60
'Run the query against the server
With oWinhttp
Call .Open("POST", WebURL)
Call .SetRequestHeader("Cookie", "pjmauth=" & tokenStr)
Call .SetRequestHeader("Content-Type", "text/xml")
Call .SetRequestHeader("Content-Length", Len(xmlSubmittal))
Call .Send(xmlSubmittal)
Call .WaitForResponse
'Store the return XML into DOM Document
ReturnXML.async = False
ReturnXML.validateOnParse = False
ReturnXML.LoadXML (.ResponseText)
'Terminate connection
Call oWinhttp.abort
End With
'Extract nodes we are going to need
Set ItemList = ReturnXML.SelectNodes("//DSRSRREGAwardHourly")