EDN Admin
Well-known member
<p align=left><font face=Arial size=2><font color="#0000ff <span class=m>Hi all,</font></font>
<p align=left><font face=Arial size=2><font color="#0000ff <span class=m></font></font>
<p align=left><font face=Arial size=2><font color="#0000ff <span class=m>I have an app that send a request to a php webpage and get an XML data as the response. How I planned to read the XML data is as shown below:</font></font>
<p align=left><font face=Arial size=2><font color="#0000ff <span class=m></font></font> <font face=Arial size=2><font color="#0000ff <span class=m><font size=2>
<p align=left></font><font color="#008080" size=2>
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Snippet <font face=Arial size=2><font color="#0000ff <span class=m>
<p align=left><font color="#008080" size=2>WebRequest</font><font size=2> requestInfo = </font><font color="#008080" size=2>WebRequest</font><font size=2>.Create("http://something.php?</font><font color="#800000" size=2>username="</font><font size=2> + username + </font><font color="#800000" size=2>"&password="</font><font size=2> + password + </font><font color="#800000" size=2>"&infotype=general&startdate="</font><font size=2> + dateFrom + </font><font color="#800000" size=2>"&enddate="</font><font size=2> + dateTo + </font><font color="#800000" size=2>"&state="</font><font size=2> + state + </font><font color="#800000" size=2>"&city="</font><font size=2> + city);
<p align=left>requestInfo.Timeout = 30000; <font color="#008000" size=2>
<p align=left>//Get the response </font><font size=2>
<p align=left></font><font color="#008080" size=2>WebResponse</font><font size=2> response = requestInfo.GetResponse();
<p align=left></font><font color="#008080" size=2>Stream</font><font size=2> responseStream = response.GetResponseStream(); </font></font></font></font><font face=Arial size=2><font color="#0000ff <span class=m><font size=2>
<p align=left></font><font color="#008000" size=2>//Read response using XMLReader </font><font size=2>
<p align=left></font><font color="#008080" size=2>XmlReader</font><font size=2> rdr = </font><font color="#008080" size=2>XmlReader</font><font size=2>.Create(responseStream);
<p align=left></font><font color="#0000ff" size=2>while</font><font size=2> (rdr.Read())
<p align=left>{
<blockquote dir=ltr style="margin-right:0px
<p align=left></font>WHAT Should I do here to read xml data returned by the php page?<font size=2> </blockquote>
<p align=left>} </font></font></font>
<p align=left>
<p align=left>
<p align=left>And the XML data response is this: </font>
</font></font><font face=Arial size=2><font color="#0000ff <span class=m><font size=2></font>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Snippet
<p align=left><font face=Arial size=2><font color="#0000ff <span class=m><?<span class=pi>xml version="1.0" encoding="UTF-8" <span class=m>?></font>
<div class=c style="margin-left:1em;text-indent:-2em" align=left><a class=b> <font face="Courier New" color="#ff0000 -</font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 badawi</font><span class=m><font color="#0000ff ></font>
<blockquote class=e dir=ltr style="margin-right:0px
<div class=c style="margin-left:1em;text-indent:-2em" align=left><a class=b> <font face="Courier New" color="#ff0000 -</font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 generalinfo</font><span class=m><font color="#0000ff ></font> </blockquote>
<div class=k align=left>
<blockquote class=e dir=ltr style="margin-right:0px
<div class=c style="margin-left:1em;text-indent:-2em" align=left><a class=b> <font face="Courier New" color="#ff0000 -</font> <span class=m><font color="#0000ff <</font><font color="#990000 <span class=t>content<span class=t> id</font><span class=m><font color="#0000ff ="</font><b>298</b><font color="#0000ff <span class=m>"<span class=m>></font>
<blockquote dir=ltr style="margin-right:0px
<div class=e align=left>
<div style="margin-left:1em;text-indent:-2em <span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font><span class=tx> tambah aktiviti <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font><span class=tx>
ghjhjkhjk,
" <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font><span class=tx> 2007-11-23 00:00:00 <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font> </blockquote></blockquote>
<div class=e dir=ltr align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 content</font><span class=m><font color="#0000ff ></font>
<blockquote class=e dir=ltr style="margin-right:0px
<div class=c dir=ltr style="margin-left:1em;text-indent:-2em" align=left><a class=b> <font face="Courier New" color="#ff0000 -</font> <span class=m><font color="#0000ff <</font><font color="#990000 <span class=t>content<span class=t> id</font><span class=m><font color="#0000ff ="</font><b>295</b><font color="#0000ff <span class=m>"<span class=m>></font>
<blockquote dir=ltr style="margin-right:0px
<div class=e align=left>
<div style="margin-left:1em;text-indent:-2em <span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font><span class=tx> Aktiviti Harian <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font><span class=tx>
Apakah Aktiviti Harian Anda?
-adiasma <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font><span class=tx> 2007-11-21 00:00:00 <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font> </blockquote>
<div class=e dir=ltr align=left><span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 content</font><span class=m><font color="#0000ff ></font>
<div class=c dir=ltr style="margin-left:1em;text-indent:-2em" align=left><a class=b> <font face="Courier New" color="#ff0000 -</font> <span class=m><font color="#0000ff <</font><font color="#990000 <span class=t>content<span class=t> id</font><span class=m><font color="#0000ff ="</font><b>297</b><font color="#0000ff <span class=m>"<span class=m>></font>
<blockquote dir=ltr style="margin-right:0px
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font><span class=tx> EMAIL FOR CONTENT APPROVER <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font><span class=tx>
TESTING FOR CONTENT APPROVER
-ADIASMA <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font><span class=tx> 2007-11-22 00:00:00 <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font> </blockquote>
<div class=e dir=ltr align=left><span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 content</font><span class=m><font color="#0000ff ></font>
<div class=e align=left><span class=m><font color="#0000ff </font> </blockquote>
<div class=e align=left><span class=m><font color="#0000ff </font> </font>
<p align=left>
<p align=left> </font>
<div class=e align=left><span class=m><font color="#0000ff How can i read through all the data in this XML data and save them in sql server database?</font>
<div class=e align=left><span class=m><font color="#0000ff Any help/hint/guide is really appreciated.</font>
<div class=e align=left><span class=m><font color="#0000ff Thanks in advance.</font>
<div class=e align=left><span class=m><font color="#0000ff </font>
<div class=e align=left><span class=m><font color="#0000ff Sha</font> </font></font></font></font></font></font></font></font></font></font></font></font></font>
View the full article
<p align=left><font face=Arial size=2><font color="#0000ff <span class=m></font></font>
<p align=left><font face=Arial size=2><font color="#0000ff <span class=m>I have an app that send a request to a php webpage and get an XML data as the response. How I planned to read the XML data is as shown below:</font></font>
<p align=left><font face=Arial size=2><font color="#0000ff <span class=m></font></font> <font face=Arial size=2><font color="#0000ff <span class=m><font size=2>
<p align=left></font><font color="#008080" size=2>
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Snippet <font face=Arial size=2><font color="#0000ff <span class=m>
<p align=left><font color="#008080" size=2>WebRequest</font><font size=2> requestInfo = </font><font color="#008080" size=2>WebRequest</font><font size=2>.Create("http://something.php?</font><font color="#800000" size=2>username="</font><font size=2> + username + </font><font color="#800000" size=2>"&password="</font><font size=2> + password + </font><font color="#800000" size=2>"&infotype=general&startdate="</font><font size=2> + dateFrom + </font><font color="#800000" size=2>"&enddate="</font><font size=2> + dateTo + </font><font color="#800000" size=2>"&state="</font><font size=2> + state + </font><font color="#800000" size=2>"&city="</font><font size=2> + city);
<p align=left>requestInfo.Timeout = 30000; <font color="#008000" size=2>
<p align=left>//Get the response </font><font size=2>
<p align=left></font><font color="#008080" size=2>WebResponse</font><font size=2> response = requestInfo.GetResponse();
<p align=left></font><font color="#008080" size=2>Stream</font><font size=2> responseStream = response.GetResponseStream(); </font></font></font></font><font face=Arial size=2><font color="#0000ff <span class=m><font size=2>
<p align=left></font><font color="#008000" size=2>//Read response using XMLReader </font><font size=2>
<p align=left></font><font color="#008080" size=2>XmlReader</font><font size=2> rdr = </font><font color="#008080" size=2>XmlReader</font><font size=2>.Create(responseStream);
<p align=left></font><font color="#0000ff" size=2>while</font><font size=2> (rdr.Read())
<p align=left>{
<blockquote dir=ltr style="margin-right:0px
<p align=left></font>WHAT Should I do here to read xml data returned by the php page?<font size=2> </blockquote>
<p align=left>} </font></font></font>
<p align=left>
<p align=left>
<p align=left>And the XML data response is this: </font>
</font></font><font face=Arial size=2><font color="#0000ff <span class=m><font size=2></font>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Snippet
<p align=left><font face=Arial size=2><font color="#0000ff <span class=m><?<span class=pi>xml version="1.0" encoding="UTF-8" <span class=m>?></font>
<div class=c style="margin-left:1em;text-indent:-2em" align=left><a class=b> <font face="Courier New" color="#ff0000 -</font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 badawi</font><span class=m><font color="#0000ff ></font>
<blockquote class=e dir=ltr style="margin-right:0px
<div class=c style="margin-left:1em;text-indent:-2em" align=left><a class=b> <font face="Courier New" color="#ff0000 -</font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 generalinfo</font><span class=m><font color="#0000ff ></font> </blockquote>
<div class=k align=left>
<blockquote class=e dir=ltr style="margin-right:0px
<div class=c style="margin-left:1em;text-indent:-2em" align=left><a class=b> <font face="Courier New" color="#ff0000 -</font> <span class=m><font color="#0000ff <</font><font color="#990000 <span class=t>content<span class=t> id</font><span class=m><font color="#0000ff ="</font><b>298</b><font color="#0000ff <span class=m>"<span class=m>></font>
<blockquote dir=ltr style="margin-right:0px
<div class=e align=left>
<div style="margin-left:1em;text-indent:-2em <span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font><span class=tx> tambah aktiviti <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font><span class=tx>
ghjhjkhjk,
" <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font><span class=tx> 2007-11-23 00:00:00 <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font> </blockquote></blockquote>
<div class=e dir=ltr align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 content</font><span class=m><font color="#0000ff ></font>
<blockquote class=e dir=ltr style="margin-right:0px
<div class=c dir=ltr style="margin-left:1em;text-indent:-2em" align=left><a class=b> <font face="Courier New" color="#ff0000 -</font> <span class=m><font color="#0000ff <</font><font color="#990000 <span class=t>content<span class=t> id</font><span class=m><font color="#0000ff ="</font><b>295</b><font color="#0000ff <span class=m>"<span class=m>></font>
<blockquote dir=ltr style="margin-right:0px
<div class=e align=left>
<div style="margin-left:1em;text-indent:-2em <span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font><span class=tx> Aktiviti Harian <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font><span class=tx>
Apakah Aktiviti Harian Anda?
-adiasma <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font><span class=tx> 2007-11-21 00:00:00 <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font> </blockquote>
<div class=e dir=ltr align=left><span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 content</font><span class=m><font color="#0000ff ></font>
<div class=c dir=ltr style="margin-left:1em;text-indent:-2em" align=left><a class=b> <font face="Courier New" color="#ff0000 -</font> <span class=m><font color="#0000ff <</font><font color="#990000 <span class=t>content<span class=t> id</font><span class=m><font color="#0000ff ="</font><b>297</b><font color="#0000ff <span class=m>"<span class=m>></font>
<blockquote dir=ltr style="margin-right:0px
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font><span class=tx> EMAIL FOR CONTENT APPROVER <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 title</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font><span class=tx>
TESTING FOR CONTENT APPROVER
-ADIASMA <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 detail</font><span class=m><font color="#0000ff ></font>
<div class=e style="margin-left:1em;text-indent:-2em" align=left><span class=b> <font face="Courier New" color="#ff0000 </font> <span class=m><font color="#0000ff <</font><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font><span class=tx> 2007-11-22 00:00:00 <span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 date</font><span class=m><font color="#0000ff ></font> </blockquote>
<div class=e dir=ltr align=left><span class=m><font color="#0000ff </< FONT><span class=t><font color="#990000 content</font><span class=m><font color="#0000ff ></font>
<div class=e align=left><span class=m><font color="#0000ff </font> </blockquote>
<div class=e align=left><span class=m><font color="#0000ff </font> </font>
<p align=left>
<p align=left> </font>
<div class=e align=left><span class=m><font color="#0000ff How can i read through all the data in this XML data and save them in sql server database?</font>
<div class=e align=left><span class=m><font color="#0000ff Any help/hint/guide is really appreciated.</font>
<div class=e align=left><span class=m><font color="#0000ff Thanks in advance.</font>
<div class=e align=left><span class=m><font color="#0000ff </font>
<div class=e align=left><span class=m><font color="#0000ff Sha</font> </font></font></font></font></font></font></font></font></font></font></font></font></font>
View the full article