XmlNode keeps saying there is no nodes but there is

odomourse

New Member
\[code\]using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Net;using System.Text;using System.Windows.Forms;using System.Xml;namespace WindowsFormsApplication1{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Plus_Click(object sender, EventArgs e) { string FValue = http://stackoverflow.com/questions/11143233/id.Text; string SValue = id2.Text; string ending; string url ="http://localhost:56254/api/add?id=" + FValue + "&id2=" + SValue; WebClient client = new WebClient(); client.Headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1"; client.Headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; string data = http://stackoverflow.com/questions/11143233/client.DownloadString(url); XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml(data); --> XmlNode xnode = xdoc.SelectSingleNode("End"); ending = xnode.InnerText; Answer.Text = ending; } }}\[/code\]This is my code that keeps giving me a null at ending and if I put a breaker at arrow it tells me count = 0. Here is my xml:\[code\]- <Calcs xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Calculator.Models"> <End>10</End> <FValue>5</FValue> <SValue>5</SValue> </Calcs>\[/code\]And when I call End it keeps telling me no node is called End.... and keeps giving me null am I doing something wrong?http://i45.tinypic.com/24cgkld.png
 
Back
Top