Ôõô°Ñ¿Í»§¶Ë´Ówebservice»ñµÃµÄxmlת»»³Érecordset£¿
ÈçÌâ¡£
webServiceµÄº¯ÊýÈçÏ£º
VB.NET code:
Public Function RecordSetBySql(ByVal Sql As String) As XmlDataDocument
Dim xRs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim st As Stream
Dim xd As XmlDataDocument
xRs = New ADODB.Recordset
cmd = New ADODB.Command
st = New Stream
xd = New XmlDataDocument
xRs.Open(Sql, SDConn, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic)
xRs.Save(st, PersistFormatEnum.adPersistXML)
st.Flush()
st.Position = 0
xd.LoadXml(st.ReadText(st.Size))
st.Close()
xRs.Close()
conn.Close()
Return xd
End Function
{{
Ïà¹ØÎÊ´ð£º
´ÓÊý¾Ý¿âÖвéѯһÕűíµÄÊý¾Ý
select ²¿ÃÅ,ÐÕÃû from tb
ÈçºÎ²ÅÄÜÉú³ÉÏÂÃæµÄxml¸ñʽÎļþ
<folder state="unchecked" label="È«²¿">
¡¡¡¡<folder state="unchecked" isBra ......
ÎÒÓÐÒ»¸öÀàËƵÄxmlµÄ string£¬Ïëͨ¹ý±éÀúÔõô¸öxml Êä³öÎÒÏëÒªµÄelementµÄÖµ
xml Ϊ£º
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>DISCOVER_XML_ME ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎĶ¼¿É¡£
ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù.
°¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿
ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......
XMLÎļþÄÚÈÝ£º
- <ResList>
<page>0</page>
- <resItem>
<resName>WWW</resName>
</resItem>
- <resItem>
&nb ......
ÓÃSAX½âÎöXMLÖУ¬Ê¹ÓÃÕâ¶Î´úÂë
String feed="http://www.google.com/ig/api?weather="+strCity;
URL url = new URL(feed.replace(" ", "%20"));
......