Subject: ASP Refresh Problem...
Posted By: babloo81 Post Date: 11/14/2003 3:15:03 AM
I have the following code...
<%
    Response.Expires = -1000
    Dim x1
    set x1 = Server.CreateObject("MSXML.DOMDocument")
    x1.loadXML("<P><T a='1' n='ttt'/><T a='2' n='yyy'/></P>")
    dim xmlTempNode
    set xmlTempNode = x1.selectSingleNode("//T[@a='4']")
    if (xmlTempNode is Nothing) then
        Response.Write "Does not exists..."
    else
        Response.Write "Exists"
        Response.Write " value is:"
        Response.Write xmlTempNode.attributes.getNamedItem("n").text
   end if
    set xmlTempNode = nothing
    set x1 = nothing
%>

This code seems to be ok, when I execute it for the first time.
If I change,
    set xmlTempNode = x1.selectSingleNode("//T[@a='4']")
to
    set xmlTempNode = x1.selectSingleNode("//T[@a='2']")
There is no effect in the code.
But then if I modify the XML (say by modifying an attribute value)
it shows the result correctly.

Thanks,
Babloo

Reply By: pgtips Reply Date: 11/14/2003 7:15:38 AM
Hi Babloo,

this has always worked for me:

Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1


BTW in your XPath, using // is a bad habit to get into because it can be a very expensive operation (not in XML as small as your example here, though).  Its much better to use the full path if you know it, e.g. /P/T[@a='4']

rgds
Phil

Go to topic 6483

Return to index page 1005
Return to index page 1004
Return to index page 1003
Return to index page 1002
Return to index page 1001
Return to index page 1000
Return to index page 999
Return to index page 998
Return to index page 997
Return to index page 996