Solved

Get value from XPathNavigator

Posted on 2006-11-28
3
505 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
3 Comments
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 500 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

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