Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-03-24
1
Medium Priority
?
557 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
B_Dorsey earned 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

715 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