Altova Mailing List Archives


Re: How do I check if a SelectSingleNode returned a node or not?

From: "Tarren" <noemail@--------.--->
To: NULL
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!
>
>
> 


Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.