retrive xml value from localfile

retrive xml value from localfile

am 19.08.2007 20:49:52 von Jon Paal

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

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

response.write getXMLField("//actions[@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 ======




none
login.asp


checkLogin.asp
welcome.asp

Re: retrive xml value from localfile

am 20.08.2007 05:43:27 von Jon Paal

found the error, should be :

Set objField = objDom.selectSingleNode(strFieldName)