?
Solved

Get value from XPathNavigator

Posted on 2006-11-28
3
Medium Priority
?
526 Views
Last Modified: 2012-06-21
Hi,

I have XPathNavigator,

Now If I get the errors node in the XPathNavigator, then I want the complete errors node into the string

XPathNavigator nav

            XPathNodeIterator iterator = nav.Select("//errors");  

Can anyone help me to get the errors node in the string

Kind Regards
           
0
Comment
Question by:dinesh_bali
[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
3 Comments
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 2000 total points
ID: 18033211
First, you have a set of nodes from the select().
So you may need to walk through all of them.

Convert the error element (I assume it's an XmlElement) - depends on the element structure.
It's better if you know it.
I assume it's simple one, e.g.:

<error id="1234">Some info about the error</error>

In this case you do something like:

            XPathNodeIterator iterator = nav.Select("//errors");

            foreach (XmlNode node in iterator)
            {
                string errorText = (node as XmlElement).InnerText;
                Debug.WriteLine(errorText);
                // or
                string errorID = (node as XmlElement).GetAttribute("id");
                Debug.WriteLine(errorID);
               
            }
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 18036267
can u post ur xml file
0
 

Author Comment

by:dinesh_bali
ID: 18042703
Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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