USZip has a GetInfoByZip(String zipcode) method which retuns an XML
data......
For Example....
USZip u = new USZip();
System.Console.WriteLine(u.GetInfoByZip("49544"));
****OutPut************
<?xml version="1.0" encoding="utf-8" ?>
- <NewDataSet>
- <Table>
<CITY>Grand Rapids</CITY>
<STATE>MI</STATE>
<ZIP>49544</ZIP>
<AREA_CODE>616</AREA_CODE>
<TIME_ZONE>E</TIME_ZONE>
</Table>
</NewDataSet>
********************************
I want this data to be displayed into a dataset....i tried using
DataSet.ReadXml(u.GetInfoByZip("49544"))...but iam getting an error
saying cannot convert Xml.XMlNode data into String..may be because
ReadXml() don't hav such type of argument......can any tell me how to
convert this Xml data into DataSet..................thankyou
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!148.entry
You're lucky day!
Xml To Xml Conversion
"shakthi" <shak...@gmail.com> wrote in message
news:1184100163.9...@o61g2000hsh.googlegroups.com...
private EmpDataDSWithValidateMethod GetDataSet1()
{
EmpDataDSWithValidateMethod ds = new EmpDataDSWithValidateMethod();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<?xml version=\"1.0\"?><EmpDataDS>");
sb.Append("<Emp>");
sb.Append("<EmpID>123</EmpID>");
sb.Append("<LastName>Smith</LastName>");
sb.Append("<FirstName>John</FirstName>");
sb.Append("<SSN>222-22-2222</SSN>");
sb.Append("<DateOfBirth>" + DateTime.Now.ToLongDateString() +
"</DateOfBirth>");
sb.Append("</Emp>");
sb.Append("<Emp>");
sb.Append("<EmpID>456</EmpID>");
sb.Append("<LastName>Jones</LastName>");
sb.Append("<FirstName>Mary</FirstName>");
sb.Append("<SSN>333-33-3333</SSN>");
sb.Append("<DateOfBirth>01/01/1972</DateOfBirth>");
sb.Append("</Emp>");
sb.Append("</EmpDataDS>");
System.IO.MemoryStream ms = new System.IO.MemoryStream();
System.IO.StreamWriter writer = new System.IO.StreamWriter(ms);
writer.Write(sb.ToString());
writer.Flush();
ms.Position = 0;
ds.ReadXml(ms);
return ds;
}
My sb.Append to make up a dataset is BAD coding (this is just sample code
above for testing), BUT check out how you can ReadXml a stream object.
"sloan" <sl...@ipass.net> wrote in message
news:e008jTz...@TK2MSFTNGP06.phx.gbl...
but the GetInfoByZip("xx") is a XMLNode data...so how can i take this
into string???