Click here to Skip to main content
16,011,120 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
<channeldata>
<subscreiptionid>subid</subscriptionid>
<domian>todomian</domin>
<channel>tochannel</channel>

</channeldata>
Posted
Comments
OriginalGriff 13-Dec-11 5:01am    
Don't post a new question like this - use the "Improve question" widget to edit your question and provide better information instead.
I have deleted the "old" question.
prince_rumeel 13-Dec-11 5:04am    
<channeldata>
<subscreiptionid>subid
<domian>todomian
<channel>tochannel



i need to get userid,subid,domian,channel from the following xml string.
plz help me how can i get it.how can i parse
prince_rumeel 13-Dec-11 5:05am    
<<channeldata>>
<<subscreiptionid>>subid<</subscriptionid>>
<<domian>>todomian<</domin>>
<<channel>>tochannel<</channel>>

<</channeldata>>

Here it is :

C#
XmlDocument chanelData= new XmlDocument();
chanelData.LoadXml(@"<channeldata>
                    <subscriptionid>subid</subscriptionid>
                    <domain>todomian</domain>
                    <channel>tochannel</channel>
                </channeldata>");
foreach (XmlNode node in chanelData.SelectNodes("/channeldata/*"))
    Console.WriteLine(node.Name + " = " +node.InnerText);

Console.ReadKey();



Good Luck
 
Share this answer
 
C#
XmlTextReader r = new XmlTextReader("xml file path");
string strval1,strval2,strval3;
r.Read();
while (r.Read())
{
  if (r.NodeType == XmlNodeType.Element)
  {
   if (r.Name =="subscreiptionid" )
   {
    r.Read();
    strval1 = Convert.ToString(r.Value);
   }
   elseif(r.Name =="domain" )
   {
    r.Read();
    strval2 = Convert.ToString(r.Value);
   }
   elseif(r.Name =="channel" )
   {
    r.Read();
    strval3 = Convert.ToString(r.Value);
   }
  }
}
 
Share this answer
 
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...

A very quick search gave this: How to read XML from a file by using Visual C#[^]
 
Share this answer
 
v2

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