Altova Mailing List Archives
>microsoft.public.xml Archive Home
>Thread Prev - How do I check if a SelectSingleNode returned a node or not?
>Thread Next - Re: How do I check if a SelectSingleNode returned a node or not?
Re: How do I check if a SelectSingleNode returned a node or not?
Date: 12/15/2004 8:51:00 AM
Neil Smith answered it in a post from 12/6 that I discovered after posting this question. if oAD is nothing then '<== will be true if no nodes Thanks all. Thanks Neil. :) "Tarren" <noemail@t...> wrote in message news:OJnHqwq4EHA.2124@T...... > Hi: > > I am writing a classic ASP page to check if a node exists for the current > day. > > If the node does exist, do some code, otherwise, do some other code. How > do I check if a SelectSingleNode returned a node or not? > > oXML.async = false > oXML.load(Server.MapPath("checkAD.xml")) > dim sXPath > sXPath = "/ads/ad[datechosen='12/16/2004']" > > dim oAD > set oAD = oXML.selectSingleNode(sXPath) > > '===========here is where I am stuck=================== > if oAD 'how do i check if it returned a node? > '=============================================== > Response.Write "Element Found" > else > Response.Write "No element for this date" > end if > > here is the xml file > <ads> > <ad id="1000"> > <datechosen>12/15/2004</datechosen> > <title>wed ad</title> > <adfile>wed.wmv</adfile> > </ad> > <ad id="1002"> > <datechosen>12/14/2004</datechosen> > <title>mon ad</title> > <adfile>mon.wmv</adfile> > </ad> > </ads> > > > thanks! > > >