Click here to Skip to main content
15,917,321 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

var formresult = (divelement.Descendants("form")).ToArray();


I am iterating form tag where I am getting the below result.
XML
<form>
  <cc1:groupname xmlns:cc1="url">ABC</cc1:groupname>
</form>

I am using var and iterate var element using foreach loop.

Now I want to check form tag where I want to check groupname tag and if it is there then I want to get value i.e. ABC
but the problem is I cannot direct check "cc1:groupname" value.

How can I do this?

Thanks
sjs4u
Posted
Updated 12-Jan-11 22:58pm
v2
Comments
R. Giskard Reventlov 13-Jan-11 5:13am    
Could you not give the control an id and search based on that with getElementById?

1 solution

You can get any node fi you know the TagName. i.e."cc1:groupname"
following is the code to get the value. I think it will help.

C#
//here doc is xmlDocument 
XmlNodeList NodesCollection = doc.GetElementsByTagName("cc1:groupname");

foreach (XmlNode _node in NodesCollection )
{
   //You can the value with following property (_node.innertext)
     string value = _node.innertext ;
}
 
Share this answer
 
v3
Comments
Ankur\m/ 13-Jan-11 6:19am    
Use <PRE> tags ('code block') to surround the code snnipet.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900