How to Xml Reader child nodes with C#

424 Views Asked by At
protected void Page_Load(object sender, EventArgs e)
{
    XmlReader xmlReader = XmlReader.Create("https://betting.api.bwin.com/V2/CalendarFeed.svc/?x-bwin-accessId=apikey");
    string tablo = "";
    while (xmlReader.Read())
    {           
        if ((xmlReader.NodeType == XmlNodeType.Element) )
        {                
            if (xmlReader.HasAttributes)
            {
                tablo += "<table>";
                tablo += "<caption>" + xmlReader.GetAttribute("name")
                +  "</caption>";                 
            }               
        }          
    }

    tablo += "</tr>";
    tablo += "</table>";
    div.InnerHtml += tablo;   
}
1

There are 1 best solutions below

0
On

Your XML does not seem to be well formed.

Check out how to create a proper one here and about reading childnodes check here