SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : XML Technologies :

Previous DiscussionNext Discussion
 selectNodes issue/question

Set NodeList = objXMLDoc.selectNodes("/MarketingList/TargetClient/FNAME | LNAME")

is this proper syntax? I'm trying to grab both "FNAME" and "LNAME" nodes and combine them into one value with no space in between. Make sense?

thanks for ANY help!

Started By danthewebguy on Aug 10, 2005 at 12:24:36 PM

24 Response(s) | Reply

Earlier Replies | Replies 18 to 24 of 24 | Later Replies
Goto Page: 4 3 2 1
danthewebguy on Aug 11, 2005 at 9:59:36 AM (# 18)

that makes sense, but, error:
"Object doesn't support this property or method: 'NodeList.Count'"


BachusII on Aug 11, 2005 at 11:12:40 AM (# 19)

If only a single node is matched, .selectSingleNode( ... ) could be used instead of .selectNodes( ... ).


danthewebguy on Aug 11, 2005 at 11:19:06 AM (# 20)

Set NodeList = objXMLDoc.selectSingleNode("/MarketingList/TargetClient[ concat( FNAME, LNAME ) = "& sSourcePage &" ]")


If NodeList.Count = 0 Then
Response.Write "You are a user! "
Else
Response.Write "you are NOT a user! "
End If

returns an error:
"ASPCode
Number -2146827864
Source
Category Microsoft VBScript runtime
File /custom_errors/custom404.asp
Line 211
Column -1
Description Object required: 'NodeList'
ASPDescription
URL /custom_errors/custom404.asp "


BachusII on Aug 11, 2005 at 11:31:16 AM (# 21)

First let's confirm that the query is correct.

What are the results for something you know (and checked) to be correct? (does exist)
And for something that isn't correct? (does not exist)


danthewebguy on Aug 11, 2005 at 11:34:31 AM (# 22)

well, I know that if I type in "http://www.company.com/tommoore" it should return "you are a user" because that is the first name in the xml file . . . fname=tom, lname=moore. Is that what you mean? Oh, and since I make the variable "sSourcePage" to pull the URL out after the slash, I know that "tommoore" is being compared against the "NodeList". Did that make sense? :)


danthewebguy on Aug 12, 2005 at 7:35:54 AM (# 23)

I may have just given up! :(


MHenke on Aug 23, 2005 at 2:16:15 AM (# 24)

Tho I don't know VBScript, I can say that the an XPath like /MarketingList/TargetClient[concat(FNAME, LNAME ) = 'somename'] looks OK.
But two remarks:

  • The path you're using ("/MarketingList/TargetClient[ concat( FNAME, LNAME ) = "& sSourcePage &" ]") is missing the (single) quotes around the sSourcePage variable, so all queries most likely results in an empty nodeset, regardles what name you're query
  • Chris has mentioned that selectNodes always returns a (possibly empty) collection, but I could imagine that selectSingleNode won't, that is, results in a single node (not a NodeList) if the result set is not empty and in NULL otherwise. So NodeList.Count = 0 will result in an error in the above mentioned scenario

May you want to try something along this (provided that you havn't already given up... 8 )

Set NodeList = objXMLDoc.selectNodes("/MarketingList/TargetClient[concat(FNAME, LNAME) = '"& sSourcePage & "']")

If NodeList.Count = 0 Then
Response.Write "You are a user! "
Else
Response.Write "you are NOT a user! "
End If

 


Earlier Replies | Replies 18 to 24 of 24 | Later Replies
Goto Page: 4 3 2 1

To respond to a discussion, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password
Copyright 1997-2004 InsideDHTML.com, LLC. All rights reserved.