473,378 Members | 1,319 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

using variable as attribute in xpath expression - wrong group?

Hi, I'm using the following xmlDocument and xpath to load a file using
a variable.

I've tried several renditions of the xpath using the variable but
without success (error: object variable not set). If I hardcode it as
[@name="Label"] it works so I know the xpath is ok, except for the
variable syntax?

Any hints appreciated. Thanks, kathy

Code:

Dim strStation As String = "Label" 'ultimately need var set from
control
Dim xDoc As New XmlDocument()
xDoc.Load(Server.MapPath("test.xml"))
Dim xNode = xNode.SelectSingleNode("/WorkFlow/Assembly/Station[@name='"
& strStation & "']/WI[1]/@doc")
Dim strWI As String = xDoc.InnerText.ToString()
Nov 17 '05 #1
0 1665

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: GIMME | last post by:
For starters .... If : //input is the xpath syntax to see if an element with an attribute named start_date exists ... Then what is the xpath syntax to return elements having
3
by: axial | last post by:
Is there a way to define a variable by resolving other variables? I'm trying to build an "uber-variable" from user-selected components. I have control over the XML and can change it as needed. ...
3
by: jose.jeria | last post by:
I have the following Code: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes" encoding="UTF-8"/>...
2
by: Jon Martin Solaas | last post by:
Hi, I have a general document somewhat like this: -------------------------------------- <root> <level1> <level2> <interestingstuff number="2"/> <interestingstuff number="3"/>...
2
by: Alistair Bayley | last post by:
(.Net framework version 1.1.4322) The following XSL test case is rejected by System.Xml.Xsl.XslTransform, with an XsltException: "($dummy)+0 is an invalid XPath expression." If you remove the...
6
by: Chua Wen Ching | last post by:
Hi there, I had this xml file with me (not yet consider implementing xml namespaces yet). <?xml version='1.0'?> <Object> <Windows> <EID>1</EID> <EDesc>Error 1</EDesc> </Windows>
2
by: jobooker | last post by:
I'm having issues sorting. The short description is, how do I set the select attribute of xsl:sort to be the value of an xsl:variable? The longer description follows: What I want to do is to be...
4
by: David Schwartz | last post by:
So, I'm having a bit of a time trying to insert an <imgtag into an <atag using an xsl variable. Consider the following template. The contents of the foo variable doesn't show up in the anchor. When...
9
by: shakilalig | last post by:
Hi All, I am writing an XSL to transform the XML to XML.Only change i need in xml is to add the value for the price element under book tag for which publisher location is "World". The...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.