Solved

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

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

816 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

8 Experts available now in Live!

Get 1:1 Help Now