Solved

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

Posted on 2004-09-23
7
284 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Coding C# in Linux 8 60
Keyboard 2 32
What namespace do I need to import? 2 25
transaction in asp.net, sql server 6 31
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

813 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now