Solved

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

Posted on 2004-09-23
7
287 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

630 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