xpath again - not xslt ? but to select node in asp.net

Hi again,

I'm using the following xpath (works in visualizer) with a
SelectSingleNode("xpath") statement.

//Station[@name="Station1"]/(WI[Boards/Board[@sn="583230"][@finish]])[la
st()]]/@order

Problem is I get an error "expression passed to this method should
result in a NodeSet". Of course, that (sort of) makes sense to me now (I
suppose just an attribute couldn't be a nodeset, but how would I go
about:

I need to determine if and what <WI> element is the parent of the last
<Board> is according to the above xpath.

I then need to set a variable of the @order of that WI element for that
<Board>.

If n Is Nothing Then
 Dim varOrder = 1
Else
 Dim varOrder = retrieved_order + 1....etc.

Any clues appreciated...sorry to be so stupid about this.

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
0
7/23/2003 10:14:56 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
440 Views

Similar Articles

[PageSpeed] 11

> I'm using the following xpath (works in visualizer)

No it doesn't "work in visualiser" (in case you mean the XPath
Visualizer)!

The XPath Visualiser returns the following error message:

"Error No.:-2147467259
 Error: Node test expected here.

//Station[@name="Station1"]/-->(<--WI[Boards/Board[@sn="583230"][@finish]])[last()]]/@order"


So what's so strange in this error message?

> with a
> SelectSingleNode("xpath") statement.
> 
> //Station[@name="Station1"]/(WI[Boards/Board[@sn="583230"][@finish]])[la
> st()]]/@order

The error message points out explicitly what's illegal with the syntax
of the above XPath expression. The exact offending symbol is marked.

To understand why a bracket cannot be used in place of a node-test one
must have a minimal familiarity with XPath 1.0. This requires to read
a good introductory level book on XSLT/XPath (all good books about
XPath that I'm aware of usually cover XSLT too).


Another note is about the way you present your problem:
  
  - You do not provide the source xml document on which the XPath
expression is to be evaluated.

  - You do not explain what nodes you want to select.

Presenting a problem in this way makes it extremely difficult for
anyone to guess and help.

This is definitely not a good way to ask a question and not
surprisingly there would not be useful answers.

Also, if the question is so basic (e.g. not understanding a good error
message explaining an obvious syntax error), very few people would be
tempted to provide an answer for someone who has not "done their
homework" (e.g. didn't read even the simplest and most introductory
book on the subject).

Answers to random questions are not a substitute for systematic
learning, which is required in order to understand any subject.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
0
dimitren (11)
7/24/2003 7:49:13 AM
> Perhaps I posted this question to the wrong group? I still need to know
> how (in asp.net) to get a SelectSingleNode("xpath") to the point where
> AFTER that statement I can set a variable on the "order" attribute of
> the WI element. I am using the xpath WITHOUT the offending parens and
> continue to get the error about the nodesset.
> 
> Would appreciate any other replies as I'm a bit stuck.
> 
> Sorry if I didn't phrase the question correctly.

Sorry, but you continue to follow the wrong path:

 1. Where/what is the XPath expression?

 2. Where/what is your xml document (the shortest possible) on which
the XPath expression in 1. is to be evaluated?

 3. Where/what is your description in English of what you want to be
selected?

 4. Where/what is your (I assume VB.Net) ASP code (shortest possible
-- just relevant to the problem)?


In case anyone of the above is not provided (and in your present
message you provide none of them), even people willing to help will
have only to guess.


On the other side, there are many, many examples in the newsgroups of
well-formulated questions, which get solutions in a straightforward
manner.

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
0
dimitren (11)
7/24/2003 8:46:16 PM
Reply:

Similar Artilces:

net display DOES ANYONE KNOW?
i have dual display video card and 2 monitors. Net display works fine but when i open manager or any other program it extends to the second moniter. How can i ? so any program i i open it just stays on the main monitor as if there was one monitor. Do i need another video card? 2 video card? any help would be appreciated. thanks in advance Try this. Go into your video settings : Control Panel | Display | Settings tab - and uncheck the block "Extend my windows desktop to this monitor" Marc "manoj" <manoj@discussions.microsoft.com> wrote in message ne...

Getting a specific parent of any node via xpath navigation
I am storing my site structure as such: <menuItems> <menuItem> <pageID>1</pageID> </menuItem> <menuItem> <pageID>2</pageID> <menuItem> <pageID>4</pageID> <menuItem> <pageID>5</pageID> <menuItem> <pageID>6</pageID> </menuItem> </menuItem> </menuItem> </menuItem> <menuItem> <pageID>3</pageID> ...

Select which file to use in Integration Manager
I would like to be able to select the file that is to be imported with Integration Manager at the time the integration is run. Is that possible? Or can it only be set up for one file. Thanks for any help. Bob You can use vbscript to prompt you for the file name. You could use IM to use the standard Graphical UI to open file etc but that can get complicated... HS "Bob Harrison" <bobh@tds.net> wrote in message news:1139499714.660048.85750@g43g2000cwa.googlegroups.com... >I would like to be able to select the file that is to be imported with > Integration Manager at th...

Visio thinks an invisible line is present during line routing, but can't select it otherwise
I spent hours making a big flow chart only to notice when I'd finished that Visio thinks that there is an invisible long line that extends vertically up about 3/4 of the chart. At least I think that's what Visio thinks. The line is invisible so it is somewhat hard to see. The only reason I know it's there is because all of the lines that cross it have that little cross over hump in them. How can I get rid of this invisible line? -- Richard Lewis Haggard It may be an invisible line or it may be an alignment bounding box that is way too big. If the drawing doesn't ha...

Selecting all records
Hello I am looking for a way to select all the records that are returned in an Advanced Find. Currently we can only select the max per page of 250. I have tried the Ctrl +A that which I found on the web but that does not work. -- Thanks Hi Terry, When you choose to perform an action on the records, you are usually presented with options to apply that action to the currently selected record, all records on the page, orl records that match the filter criteria. If you simply want to retrieve all records, I'd recommend performing an export to excel and exporting all records that m...

XPath
Using XPath I am querying parts of XML document, " get quoted by \ - is it possible to specify not to quote " with \? <RootElement> <Element Attribute="SomeValue" /> </RootElement> XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(fileName); XmlNode xmlNode = xmlDoc.SelectSingleNode("//RootElement/Element") Print xmlNode.OuterXml <Element Attribute=\"SomeValue\"/> where I was expecting to get <Element Attribute="SomeValue"/> TIA Dennis wrote: > Using XPath I am querying parts of XML document,...

"too many records have been selected" warning in MCRM
I get the following informational message in MCRM when I select more than ten accounts to include as part of a report: "Too many records have been selected" I need to be able to generate report for more than ten accounts at a time and need to be able to change this restrictive setting. Can this be changed and if so, where do I change it? Thanks Hello Mark I do not have my report dev tools to hand but I would think that there is some code in the report that is saying dont report if more than 10 records are selected. You should download the report to an RDL file and edit i...

XPath pb
Hi In infopath, I use a XPath expression to get some nodes : var oEMailNodeList = XDocument.DOM.selectNodes("//Message/EMail"); My problem is that this method returns 0 items. Here is the DOM.xml property : <?xml version="1.0" ?> <?mso-infoPathSolution productVersion=\"11.0.5329\" PIVersion=\"1.0.0.0\" href=\"file:///C:\Documents%20and%20Settings\t-stevbe\Local%20Settings\Appli cation%20Data\Microsoft\InfoPath\7ab6e8af39fc42e2\manifest.xsf\" solutionVersion=\"1.0.0.9\" initialView=\"messagesList\" ?> <?...

Rank items, select one start date, have remaining dates follow based on rank
I have a list of projects. I have one start date. Each project has a varying amount of time to complete. I want the user to rank the projects based on importance (example when it will ship) and then, based on the individual times required to complete the rest of the projects, excel will automatically generate start and complete dates for the remaining projects. Need to know how to do this. -- rob normerica ------------------------------------------------------------------------ rob normerica's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=26316 View this t...

Selecting all subfolders for offline usage
We use Outlook2000 with Exchange2000. I have a co-worker who has created a monstrously big set of subfolders (and sub-subfolders) within his inbox. He wants to configure almost all of them for offline usage. The only way that I know to do this is to tediously go through each level and check off every box. Is there a way to select ALL of the boxes, then go back and deselect the few that he doesn't want? Yes, I know the wisest thing to do is to simplify the inbox and get rid of all the sublevels, but the user is not about to change the way he operates. Any help will be most a...

workbook select
Hi, can anyone help me with a macro to select a specific workbook that is already open? The book is called "1234" quotes & orders ( this can be called "any number" quotes and orders during my procedure, the book is switched to another book and fills data from the first book. When the procedure is complete, i need to select the original book from where i started from ("1234" quotes & orders) i might have more books open with the same quotes and orders name but diferent "1234" at the same time. so i would need it to do the following: get name...

Filter Form by Multi Selection
What I would like is to have the selection fields in the header. Based on the values inputted in the header, for the results to be displayed in the main part of the form. When there is nothing selected in the header, for all the data to show. Also, I would like the result data to be updated on tab. I've got the result data the way I would like it. I just cannot figure out how to filter it in a form. I've seen it done before. Download the sample database here: Search form - Handle many optional criteria at: http://allenbrowne.com/ser-62.html It demonstrates how to ha...

Chart Data Table
This probably seems a trivial question but I really can't work it out! Each day I plot a specific currency rate with the date. I have two charts on a worksheet. One shows the graph since I started in 2003 and the other just the current year. When I add data I click on the appropriate graph and a blue rectangle encloses the currency data and a mauve one the dates. Here is my problem - on one chart, when I drag the adjoining handles at the bottom of the table to move it to enclose the new data BOTH rectangles move together however on the other chart only ONE moves so I have to drag t...

Disabling MSIE XSLT processing
Sorry if slightly off-topic, but I have asked / researched many other places already, maybe someone here can help? MSIE has a useful (for users applications) feature of performing XSLT transformations if a stylesheet is specified in the XML file, e.g., within the data file: <?xml version="1.0"?> <?xml-stylesheet type='text/xsl' href='test.xsl'?> .... However, for testing the raw *data*, it would be very useful to disable this (with a keystroke / mouse-click or two), and just have the default MSIE display of the XML tree. Does anyone know how to do...

Selection in my drop down boxes dissappeared
In the drop down boxes, there used to be check boxes within the drop down so I could ... well select They have gone and I want them back... anyone know where to go ...

Sum of only selected cells in Excel
I have Office Xp. When using Excel is there a way to get a sum of only selected cells not in a sequence, and how can I selected those rows or cells? Sol Sum will appear in the Status bar if you enable it. And select random cells by holding down CTRL key and clicking on them S1L1Y1 wrote: > I have Office Xp. When using Excel is there a way to get a sum of only > selected cells not in a sequence, and how can I selected those rows or > cells? > Sol > > S1L1Y1 wrote: > I have Office Xp. When using Excel is there a way to get a sum of only >...

Select and display records on Form
I am trying to create a form which : (i) allows user to input criterion to select client records by various fields (ii) display the records meeting the criterion in a sub-form on the form (iii) ultimately, allow user to de-select/delete individual records from the select results before delivering each an email First I tried to launch a make-table query via a button and let the sub-form query those results. But whenever the button was pressed, it could not complete...record locking, I guess, against the sub-form which has that table "open". Then I tried to launch a simple query...

ListView multiple selection behavior
The ListView in Comtl32.dll v6.0 does multiple selection (when using Shift key) as follows (x means selected) 00xxxx xxxxxx xxxx00 Earlier versions of ListView do it as follows : 00xx00 00xx00 00xx00 Is there any way to have it do the first way (the comctl32 v6.0 way)? Thanks John ...

How to pass a Nodeset to an XPath extension function?
I am using the .NET framework v2.0.40607 with Visual C# Express and I would like to create some custom XPath functions to use directly in a XSLT stylesheet. I called System.Xml.Query.XmlArgumentList.AddExtensionObject(string, object) to register the functions I've written. The functions that take a String, Boolean or Number parameter work perfectly. However, I do not know how to create a function that will accept a Nodeset as a parameter. I tried writting a function taking a XPathNavigator object, but it does not work for all XPath queries that return a Nodeset: I get an error &qu...

XPath Validation
I'm looking for a way to Validate an XPath prior to executing the expression, without using a try catch clause. For example: I'm looking for something that would tell me that "\some/Xpath\to\Node" is invalid... Any Ideas? Hi, As far as I know, the .NET framework could not validate XPath directly with class library. The only thing we can do is to use try/catch block. Or you can try to find some 3rd-party tool such as XML spy to validate it. HTH. Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights." Thanks K...

select data from a table in a database
Hello: I want to find a field in a table in a database that matches that exact field in another table of another database. The two database IDs are TNEW and TUNIV, while the table and field in both databases is SVC00700.ORDDOCID. Here is what I have, but the data returned is not correct: select ORDDOCID from TNEW..SVC00700 where exists (select ORDDOCID from TUNIV..SVC00700.ORDDOCID) What am I doing wrong here? childofthe1980s SELECT A.ORDDOCID FROM TNEW..SVC00700 A INNER JOIN TUNIV..SVC00700 B ON (A.ORDDOCID = B.ORDDOCID) You can add any other columns from the aliased table A into ...

"Explorer /select" to select file in already-opened window
Hi, I need to programatically select/highlight a file in Windows Explorer. "Explorer /select,x:\path\to\file" works if the folder window is NOT already open, but it has no effect if the folder window is already open. I would rather not use /n to open yet another new Explorer window of the same folder. Is it possible to select a file regardless of whether the folder window is already open? Is there a Windows API for it? Thanks. ...

How do I select the email sending account for a new message
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: pop HI, im using Entourage with two separate POP email accounts. How do I select the account I want to use for sending new email messages? On 4/9/10 9:59 PM, Fbazo@officeformac.com wrote: > pop HI, im using Entourage with two separate POP email accounts. How do > I select the account I want to use for sending new email messages? When you create a new message, it will default to the default account you have set in Entourage preferences. Set in Reply & Forward. If you need to s...

CodeBehind not working or not compiling in VS2008 asp.net w/ infragistics
i have a website developed in vs2008, i have upgraded the version of infragistics controls its was using from 9.2 to 10.1. afterwards the codebehind doesnt seem to be compiling and only using the code that was there before i upgraded. i can drop controls on the page adn they show up but when i add code to modify the functionality of the page load for those controls nothing happens. also when i double click on the example asp button, it creates a script function on the html page instead of going to the code behind?? any help is appreciated! ...

Reading ASP.NET into XML DOM
Hi, i wanted to know if it is possible to easily read an asp.net file into an xml tree. the only major issues i found were: 1-asp: namespace not defined 2-<%@ ... now the first issue is easy to solve (you just add a definition for the namespace in the file, but the second issue is bothering me, becasue it seems the <%@ decleration for defining some default values/ scripting language/ is not correct xml. so, short of implementing my own xml reader, is there something that i can do? Thanks Seems like SgmlReader will be a good option. I wanted to do so so that i can do some ma...