Solved

have "absolute" xpath, want to get the node back

Posted on 2004-09-23
7
285 Views
Last Modified: 2010-04-15
I have loaded and xsd file into a treeview control, then saved "full path" to the node. When I reload this .xsd file later, I just want to select this particular node programatically. I have this line:

      nd = mSchemaXMLDoc.SelectSingleNode( "self::/" + mCurrentSchema.TagXPath.Replace( "\\", "/"));

wherein the string argument to SelectSingleNode evaluates to :

"self::/xs:schema/xs:element/xs:complexType/xs:attribute/xs:annotation"



giving the error: "The expression passed to this method should result in a NodeSet"

What am I doing wrong?
0
Comment
Question by:sperodev
  • 2
  • 2
7 Comments
 
LVL 8

Expert Comment

by:Razzie_
ID: 12131651
Well what it basically means is that string argument does not point to a node. A common problem of this is that you have a trailing '/' at the end of your xpath. It's hard to judge what's wrong without the xsd file.

I'd recommend you make absolutely sure the string argument evaluates to "self::/xs:schema/xs:element/xs:complexType/xs:attribute/xs:annotation" and if it matches the xpath in your document.
0
 

Author Comment

by:sperodev
ID: 12147200
Sorry, this wasn't a great deal of help.  The crux of the matter had more to do with those xs:'s being part of a schema. Thanks, anyway, though.
0
 

Author Comment

by:sperodev
ID: 12147205
Sorry, I meant part of a namespace.
0
 
LVL 8

Accepted Solution

by:
Razzie_ earned 225 total points
ID: 12147835
Hmm ok well it's hard without your xml and namespace file because I can't see the structure, but shouldn't it be more like nd = mSchemaXMLDoc.SelectSingleNode( "//self:" + mCurrentSchema.TagXPath.Replace( "\\", "/")); ?
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

Suggested Solutions

Title # Comments Views Activity
Sent email using Shared Mailbox from outlook in C# 5 50
How to read text with RegEx... 2 25
abstract class C# 1 31
Code works but breaks when I add one section 4 20
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 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