Solved

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

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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 …

726 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