Solved

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

Posted on 2007-03-24
1
522 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

13 Experts available now in Live!

Get 1:1 Help Now