Appogies if this is in the wrong forum, wasn't to sure if to post here or in asp forum?
I've got this function,
that looks at the record in the xml file which matches a request.querystring("sid"), but if the "sid" doesn’t match any record in the xml, I get the following error:
Is there a test I can do to make sure the record exists or not?
i've tried doing the following, but it dosn't work?
any help will be greatly appriciated
thanks
Ash
I've got this function,
Code:
Function yellowpages(strXMLFile, strXSLFile, strSid)
'Declare local variables
Dim objXML
Dim objNode
Dim objXSL
'Instantiate the XMLDOM Object that will hold the XML file.
set objXML = Server.CreateObject("Microsoft.XMLDOM")
'Turn off asyncronous file loading.
objXML.async = false
'Load the XML file.
objXML.load(strXMLFile)
'Get the XML record that you wish to view by calling the
'SelectSingleNode method and passing in the e-mail address of the
'contact.
Set objNode = objXML.SelectSingleNode("rolodex/contact[field/field_value='" & strSid & "']")
'Instantiate the XMLDOM Object that will hold the XSL file.
set objXSL = Server.CreateObject("Microsoft.XMLDOM")
'Turn off asyncronous file loading.
objXSL.async = false
'Load the XSL file.
objXSL.load(strXSLFile)
'Use the "transformNode" method of the XMLDOM to apply the XSL
'stylesheet to the XML document. Then the output is written to the
'client.
Response.Write(objNode.transformNode(objXSL))
End Function
that looks at the record in the xml file which matches a request.querystring("sid"), but if the "sid" doesn’t match any record in the xml, I get the following error:
Code:
Microsoft VBScript runtime error '800a01a8'
Object required: 'objNode'
/PU/about/yellowpages/rolodex6.asp, line 290
Is there a test I can do to make sure the record exists or not?
i've tried doing the following, but it dosn't work?
Code:
If objXML.SelectSingleNode("rolodex/contact[field/field_value='" & strSid & "']") Then
Set objNode = objXML.SelectSingleNode("rolodex/contact[field/field_value='" & strSid & "']")
' Rest of the transforming
Response.Write objNode.transformNode(objXSL)
End If
any help will be greatly appriciated
thanks
Ash