I have the following simple XML file located in a folder on my computer ("H:\UserAuthRequest.xml")
'<?xml version="1.0" encoding="utf-8" ?>
'- <UserAuthRequest>
' <UserLoginName>PRUSL</UserLoginName>
' -
'- <UserPswd>
' <CryptType>NONE</CryptType>
' <Pswd>N/A</Pswd>
' </UserPswd>
' -
'- <VendorApp>
' <VendorName VendorCode="0029">PRU</VendorName>
' <AppName>NB Pending Case Status Feed</AppName>
' <AppVer>Pru_IEXMLCaseStatus1.0</AppVer>
' </VendorApp>
' </UserAuthRequest>
What I need is just a few lines of code to get started to pull out, for example, the VendorName and AppName. I have Microsoft XML, v2.6 reference loaded and am using VBA in MSAccess 2007.
My current code snippet is:
strXML = "H:\UserAuthRequest.xml"
Dim objXML As MSXML2.DOMDocument
Set objXML = New MSXML2.DOMDocument
If Not objXML.loadXML(strXML) Then 'strXML is the string with XML'
'Err.Raise objXML.parseError.ErrorCode, , objXML.parseError.reason
End If
Dim VendorApp As IXMLDOMNode
Set VendorApp = objXML.ChildNodes
Debug.Print VendorApp.SelectSingleNode("VendorName").Text
Debug.Print VendorApp.SelectSingleNode("AppName").Text
Debug.Print VendorApp.SelectSingleNode("AppVer").Text
end sub
I get a debug error at the .firstChild line. - Wrong datatype.
I know the code needs some work. Any assistance to just get started on this would be greatly appreciatedl
'<?xml version="1.0" encoding="utf-8" ?>
'- <UserAuthRequest>
' <UserLoginName>PRUSL</UserLoginName>
' -
'- <UserPswd>
' <CryptType>NONE</CryptType>
' <Pswd>N/A</Pswd>
' </UserPswd>
' -
'- <VendorApp>
' <VendorName VendorCode="0029">PRU</VendorName>
' <AppName>NB Pending Case Status Feed</AppName>
' <AppVer>Pru_IEXMLCaseStatus1.0</AppVer>
' </VendorApp>
' </UserAuthRequest>
What I need is just a few lines of code to get started to pull out, for example, the VendorName and AppName. I have Microsoft XML, v2.6 reference loaded and am using VBA in MSAccess 2007.
My current code snippet is:
strXML = "H:\UserAuthRequest.xml"
Dim objXML As MSXML2.DOMDocument
Set objXML = New MSXML2.DOMDocument
If Not objXML.loadXML(strXML) Then 'strXML is the string with XML'
'Err.Raise objXML.parseError.ErrorCode, , objXML.parseError.reason
End If
Dim VendorApp As IXMLDOMNode
Set VendorApp = objXML.ChildNodes
Debug.Print VendorApp.SelectSingleNode("VendorName").Text
Debug.Print VendorApp.SelectSingleNode("AppName").Text
Debug.Print VendorApp.SelectSingleNode("AppVer").Text
end sub
I get a debug error at the .firstChild line. - Wrong datatype.
I know the code needs some work. Any assistance to just get started on this would be greatly appreciatedl