lr*****@gmail.com wrote:
The problem is not in the line below...
if not nodes is nothing then
it is in the for line
for i = 0 to nodes.length - 1
because nodes.length = 0
I have tested the following code with the xml you posted (after removing the
space from before the <?xml declaration and the hyphens from the
"expandable" elements.
If this code does not work for you, then you will need to decode the
incoming xml, using the Replace function to replace "<" with "<" and
">" with ">" and see if that works
<%
dim xmldom, nodes, node, attr, path, xPE, i, strMessage, j
set xmldom=createobject("msxml2.domdocument")
if xmldom.load( server.MapPath("soap.xml")) then
'Response.ContentType="text/xml"
'xmldom.save Response
'path="//deals/escanoffers/escanoffer"
path="/soap:Envelope/soap:Body/" & _
"RetrievePromotionalOpportunitiesListResponse" & _
"/RetrievePromotionalOpportunitiesListResult/deals" & _
"/escanoffers/escanoffer"
set nodes=nothing
set nodes=xmldom.selectNodes(path)
if not nodes is nothing then
if nodes.length>0 then
Response.Write "<table border=""1"" cellspacing=""0"">"
for i = 0 to nodes.length - 1
set node = nodes.nextnode
set attrs = node.attributes
if i = 0 then
Response.Write "<tr>"
for j = 0 to attrs.length-1
set attr=attrs.item(j)
response.write "<th>" & attr.nodename & "</th>"
next
Response.Write "</tr>"
end if
Response.Write "<tr>"
for j = 0 to attrs.length-1
set attr=attrs.item(j)
response.write "<td>" & attr.nodevalue & "</td>"
next
Response.Write "</tr>"
next
Response.Write "</table>"
else
Response.Write path & "did not work"
end if
else
Response.Write path & "did not work"
end if
else
set xPE=xmldom.parseError
strMessage = "errorCode = " & xPE.errorCode & vbCrLf
strMessage = strMessage & "reason = " & xPE.reason & vbCrLf
strMessage = strMessage & "Line = " & xPE.Line & vbCrLf
strMessage = strMessage & "linepos = " & xPE.linepos & vbCrLf
strMessage = strMessage & "filepos = " & xPE.filepos & vbCrLf
strMessage = strMessage & "srcText = " & xPE.srcText & vbCrLf
set xPE = nothing
Response.Write strMessage
end if
%>
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.