XML Soap Client Question

A

A Golez

Hello all,
I'm a complete newbie looking for a little advice. I am writing a Soap
Client to request weather data from the NOAA website.
(http://www.nws.noaa.gov/forecasts/xml/) and the response to the sent
request is returned in the form of a string. I know I have to use
something like XmlDocument/XmlNode to extract the text from the Xml
tags, but I'm having problems in doing in. Here's what I'm doing:
_______________________________________________________________________

private ndfdXML weatherXML = null;
private XmlDocument doc;
private XmlNode rootNode;
private XmlNodeList wList;
private DateTime startDataTime;
......

weatherXML = new ndfdXML(); //create proxy
startDateTime = new DateTime(2005, 2, 4, 9, 15, 0);

String wStr;
XmlNode nextNode;

wStr = weatherXML.NDFDgenByDay(39, -77, startDateTime, "1",

gov.weather.formatType.Item24hourly);

//Append the XML document to the main window
doc = new XmlDocument();
doc.LoadXml(wStr);

rootNode = doc.DocumentElement.FirstChild;

int j;

if (rootNode.HasChildNodes)
{

for (j=0; j<rootNode.ChildNodes.Count; j++)
{
nextNode = rootNode.NextSibling;
WeatherBox.AppendText(nextNode.InnerText + "\n");


}
}
 
D

Dennis Myrén

A,

You should save the document to disk first (XmlDocument.Save) and open with
a text editor, so that you learn the structure of the document.

Then you can use XPath to select those parts that interest you.

The XML document's root element is DocumentElement itself and not it's
FirstChild.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top