retrive xml value from localfile

what is missing with this code to retrieve value of "model' from xml file ?

===asp file=============

response.write getXMLField("//actions[ [at] action='welcome']/model")

Function getXMLField(strFieldName)
On error resume next

Dim objDom
Dim objField

'XML file object
Set objDom = Server.CreateObject("Msxml2.DOMDocument.3.0")
objDom.async = False

if objDom.Load (Server.MapPath(".") & "\Actions.xml") then

'collect information from nodes
'-------------------------------
objField = objDom.selectSingleNode(strFieldName)
If objField Is Nothing Then
getXMLField = strFieldName & " is nothing"
Else
getXMLField= objField.Text
End If
Else
getXMLField= objDom.parseError.reason
End If

'Release variables
Set objDom = Nothing

End Function


======= xml file ======

<?xml version="1.0" ?>
<actions>
<action value="">
<model>none</model>
<view>login.asp</view>
</action>
<action value="welcome">
<model>checkLogin.asp</model>
<view>welcome.asp</view>
</action>
</actions>
Jon Paal [ So, 19 August 2007 20:49 ] [ ID #1799051 ]

Re: retrive xml value from localfile

found the error, should be :

Set objField = objDom.selectSingleNode(strFieldName)
Jon Paal [ Mo, 20 August 2007 05:43 ] [ ID #1800030 ]
Webserver » microsoft.public.inetserver.asp.general » retrive xml value from localfile

Vorheriges Thema: Session Variable
Nächstes Thema: ASP/HTML not displaying