Your oXML object does not get instantiated:
Dim oXML As MSXML2.DOMDocument
Dim oNodeList As MSXML2.IXMLDOMNodeList
Dim oChild As MSXML2.IXMLDOMNode
'Instantiate the object variable
Set oXML = New MSXML2.DOMDocument
oXML.loadXML strAddresses
Set oNodeList = oXML.getElementsByTagName("Address")
I don't know if you need to do anything else for the XML part...
HTH,
Tore.
-----Original Message-----
From: rhino [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 28, 2002 1:24 PM
To: ActiveServerPages
Subject: OT: Parsing XML sent to VB dll
(sorry, but the XML board does not seem to be working, so I'm hoping
someone here will have some insight....)
I'm sending XML as a string to my VB dll. The string looks like this:
strAddresses =
<Address num=1>
<StreetNumber>123</StreetNumber>
<StreetDirection>N</StreetDirection>
<StreetName>Hickory</StreetName>
</Address>
<Address num=2>
<StreetNumber>3652</StreetNumber>
<StreetDirection>W</StreetDirection>
<StreetName>Kennedy</StreetName>
</Address>
There may be up to five addresses sent, or only one. Regardless, when the
string gets to the dll, I need to loop through the string... something
like this:
If strAddresses <> "" Then
Dim oXML As MSXML2.DOMDocument
Dim oNodeList As MSXML2.IXMLDOMNodeList
Dim oChild As MSXML2.IXMLDOMNode
oXML.loadXML strAddresses
Set oNodeList = oXML.getElementsByTagName("Address")
Dim i
For i = 0 To (oNodeList.Length - 1)
If oNodeList.Item(i) = "StreetNumber" Then
StreetNumber = oNodeList.Item(i).Text
ElseIf oNodeList.Item(i) = "StreetDirection" Then
StreetDirection = oNodeList.Item(i).Text
ElseIf oNodeList.Item(i) = "StreetName" Then
StreetName = oNodeList.Item(i).Text
End If
'The following is where I create my sql string.
'I've taken a lot out of it to simplify it.
'Sufficit it to say, I'm looping through the
'XML string (strAddresses) and adding conditions on to the
'SQL string - specified by the children of each "Address" node.
If StreetNumber <> "" Then
strCriteria = "(L.AddressNumber = '" & StreetNumber & "')"
End If
strCriteria = strCriteria & strCriteria
Next
End If
This is not working. To make the problem worse, I have no error
description to work with. I only know it is not working. Anyone see
anything wrong with the above, or have any clues that might lead me in the
right direction? Thanks in advance. Ryan
---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%
---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]