Error handling in XML

S

sushant

Hi,

I have to read a part of document & transoform into HTML using xsl.
To read the document i am using selectsinglenode with XPATH & code
runs fine.

+++++++++++++++++++++++++
Function viewDetail(strXMLFile, strXSLFile, strEMail)
Dim objXML
Dim objNode
Dim objXSL
set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.async = false
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='"
& strEMail & "']")
set objXSL = Server.CreateObject("Microsoft.XMLDOM")
objXSL.async = false
objXSL.load(strXSLFile)
Response.Write(objNode.transformNode(objXSL))
End Function
+++++++++++++++++++++++++++

But problems occur when strEmail value brings wrong data which is not
available in XML data file. In that case, it displays asp error. Is
there any way to handle the error as objXML doesnt return anything?
Please let me know if there is any.

thanks,
hungrymind
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top