This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > August 2006 > xml with asp SelectSingleNode error help appreciated





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author xml with asp SelectSingleNode error help appreciated
btclick news

2006-08-09, 6:32 am

Hi - I am very new to xml. I have a simple product list in XML and use it to
display the details of a single product at a time.

I send a product ID as a query string parameter and then use the following
code to access the product details from my XML file:



id = Trim(Request.QueryString("prodID"))

Set prodListXML = Server.CreateObject("Microsoft.XMLDOM")
prodListXML.async = False
prodListXML.load (Server.MapPath("prodlist.xml"))

Set myNode =
prodListXML.documentElement.SelectSingleNode("product[prodCode='" & id &
"']")
etc etc


This works fine until a false (non-existent) prodID is sent via the
queryString - (by altering the queryString). I then have a message from IIS
saying:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch

How do I test for this error so that I can deal with it (by a
response.redirect).

Thanks very much in advance to anyone who is kind enough to help.

John B


Joe Fawcett

2006-08-09, 7:13 pm

You can check:
If Not myNode Is Nothing Then
'proceed
Else
'Node not found
End If

Be careful using the prog id "Microsoft.XMLDOM", you can't be sure which
version of the parser you'll get. Try to use "Msxml2.DomDocument.4.0" at
least otherwise you may find that you cannot use XPath as XSLPattern is used
for searches. Look in the sdk for more on this.


--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name

"btclick news" <siteweave@btclick.com> wrote in message
news:3PKdnW57tLodNETZRVnyuA@bt.com...
> Hi - I am very new to xml. I have a simple product list in XML and use it
> to
> display the details of a single product at a time.
>
> I send a product ID as a query string parameter and then use the following
> code to access the product details from my XML file:
>
>
>
> id = Trim(Request.QueryString("prodID"))
>
> Set prodListXML = Server.CreateObject("Microsoft.XMLDOM")
> prodListXML.async = False
> prodListXML.load (Server.MapPath("prodlist.xml"))
>
> Set myNode =
> prodListXML.documentElement.SelectSingleNode("product[prodCode='" & id &
> "']")
> etc etc
>
>
> This works fine until a false (non-existent) prodID is sent via the
> queryString - (by altering the queryString). I then have a message from
> IIS
> saying:
>
> Error Type:
> Microsoft VBScript runtime (0x800A000D)
> Type mismatch
>
> How do I test for this error so that I can deal with it (by a
> response.redirect).
>
> Thanks very much in advance to anyone who is kind enough to help.
>
> John B
>
>



btclick news

2006-08-09, 7:13 pm

Thanks very much Joe - does the trick - and also thanks for the general
advice.

Best wishes

John


"Joe Fawcett" <joefawcett@newsgroup.nospam> wrote in message
news:OaIfdR7uGHA.4160@TK2MSFTNGP06.phx.gbl...
> You can check:
> If Not myNode Is Nothing Then
> 'proceed
> Else
> 'Node not found
> End If
>
> Be careful using the prog id "Microsoft.XMLDOM", you can't be sure which
> version of the parser you'll get. Try to use "Msxml2.DomDocument.4.0" at
> least otherwise you may find that you cannot use XPath as XSLPattern is

used
> for searches. Look in the sdk for more on this.
>
>
> --
>
> Joe Fawcett (MVP - XML)
>
> http://joe.fawcett.name
>
> "btclick news" <siteweave@btclick.com> wrote in message
> news:3PKdnW57tLodNETZRVnyuA@bt.com...
it[color=darkred]
following[color=darkred]
>
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews