Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2007, 08:47 AM
Authorized User
 
Join Date: Nov 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to pass query string into doc.SelectSingleNode

Hello every one
I am stuck in a problem that how to pass QueryString (Request.QueryString["RefId"]) to xpath into XML
following is the code of my

XmlNode newParent = doc.SelectSingleNode("/LinkInformation/ScreensToSupport/ScreenToSupport/SupportItems/ScreenSupportItem[RefId=@'+(Request.QueryString["RefId"])+]");

I have to pass Query String RefId in the doc.SelectSingleNode
Please any can tell me.
I will very thankful to you
Vishnu Narayan

 
Old November 6th, 2007, 08:59 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Life might be simpler for you if you split that one line into a couple of lines. This way you can check what is in the xpath variable by debugging the code - if this isn't what you want then you can change the line ot get it to work.

You include the '@' in your xPath - if this is because RefId is an attribute then it should be '@RefId'. If you're just getting it confused with the C# string literal character then you don't need it.

string refId = Request.QueryString["RefId"];

string xpath = "/LinkInformation/.../ScreenToSupportItem[RefId='" + refId + "']";

XmlNode newParent = doc.selectSingleNode(xpath);



/- Sam Judson : Wrox Technical Editor -/
 
Old November 7th, 2007, 06:15 AM
Authorized User
 
Join Date: Nov 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello sir
that its, Its working fine sir,
I am heartly thankful for early response given to me.
Vishnu






Similar Threads
Thread Thread Starter Forum Replies Last Post
To pass value of string variable to another form thillai Visual Basic 2005 Basics 5 March 13th, 2008 03:29 AM
Can't pass query string variable on secure server gnilly BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 August 24th, 2005 11:18 AM
Pass data from Web page to Word Doc kilika Classic ASP Professional 1 April 8th, 2004 06:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.