Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / July 2006

Tip: Looking for answers? Try searching our database.

Built-in ToXPathString()-type method

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Keith Patrick - 17 Jul 2006 20:28 GMT
Is there some built-in way to output a node's basic XPath without iterating
upward through an XmlNode's parent hierarchy?  I have a scenario where I
need to tell the user there was an error with a particular node, but I want
to express it as:
"There was an error with node Root/Parent2/Child2@Attribute1", but all the
methods I've looked up are more along the lines of "FromXPath".  I'm
currently using a while loop to build a string with a path, but I'd rather
just call some framework method if one exists.
Martin Honnen - 18 Jul 2006 13:18 GMT
> Is there some built-in way to output a node's basic XPath without iterating
> upward through an XmlNode's parent hierarchy?  I have a scenario where I
[quoted text clipped - 4 lines]
> currently using a while loop to build a string with a path, but I'd rather
> just call some framework method if one exists.

No, there is no such method, you need to write your own code. And be
aware that e.g.
  Root/Parent2/Child2
can select several elements, if you want a precise path to exactly one
element then you need e.g.
  Root/Parent2[1]/Child2[3]

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.