Solved

selectsingleNode object required error - how do I check it is valid

Posted on 2007-03-24
1
528 Views
Last Modified: 2008-01-09
Using the following code, when the XML markup does not find I get an error

Object required: '[object]'

How do I first check that the 3 strings are valid before tryign to make them objects and use them to overcome that error.

If not objXML.parseError.errorCode <> 0 then
  image = objXML.selectsingleNode("/dsp/result/domain/domain-listing/hybrid-items/store-offer/offer-image").text
  title = objXML.selectsingleNode("/dsp/result/domain/domain-listing/hybrid-items/store-offer/offer-name").text
  url = objXML.selectsingleNode("/dsp/result/domain/domain-listing/hybrid-items/store-offer/offer-url").text
end if

Thanks,
0
Comment
Question by:mrduckers
1 Comment
 
LVL 14

Accepted Solution

by:
B_Dorsey earned 125 total points
ID: 18787667
Try:

If not objXML.parseError.errorCode <> 0 then
  strPath = "/dsp/result/domain/domain-listing/hybrid-items/store-offer/"
  if not objXML.selectsingleNode(strPath & "offer-image") is Nothing AND not objXML.selectsingleNode(strPath & "offer-name") is Nothing AND not objXML.selectsingleNode(strPath & "offer-url") is Nothing then
      image = objXML.selectsingleNode(strPath & "offer-image").text
      title = objXML.selectsingleNode(strPath & "offer-name").text
      url = objXML.selectsingleNode(strPath & "offer-url").text
  end if
end if
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now