%
'Option Explicit
Dim sql,rsnews,count,xmlrssfeed,rscache,tcheck,xmlstatus
Response.Buffer=True
xmlrssfeed = Request.QueryString("rssurl")
if xmlrssfeed="" then xmlrssfeed="http://english.people.com.cn/rss/China.xml"
%>
<%
Function getXML(sourceFile)
dim styleFile
dim xmlsource, xmlstyle, xmldoc
styleFile = Server.MapPath("news.xsl")
'Check if Feed exists in cache:
sql = "SELECT mynews_sites.url, mynews_sites.cacheInterval, mynews_sites.lastChecked, mynews_sites.xml FROM mynews_sites WHERE (((mynews_sites.url)='" & sourceFile& "'))"
Set rscache = Server.CreateObject("ADODB.Recordset")
rscache.Open sql, conn, 3, 3
if rscache.EOF then
xmlstatus="none"
else
'How long since cache was updated?
tcheck=int((now()-rscache("lastchecked"))*24*60)
if tcheck >= rscache("cacheInterval") then
xmlstatus="update"
end if
end if
'Cache is out of date or cache does not exist. Get current from web.
if xmlstatus="none" or xmlstatus="update" then
Dim xmlhttp
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
xmlhttp.Open "GET", sourceFile, false
xmlhttp.Send
if xmlhttp.status <>200 then
%>HTTP Error: <%=xmlhttp.status%>
<%
end if
set xmlsource= xmlhttp.responseXML
if xmlsource.xml = "" then
'NEW VERSION (changed from: xmlsource.loadxml(xmlhttp.ResponseText) TO)
xmlsource.load(xmlhttp.ResponseStream)
end if
xmlsource.setProperty "ServerHTTPRequest", True
xmlsource.resolveExternals = false
xmlsource.validateOnParse = false
xmlsource.async = false
if xmlsource.parseError.errorCode <> 0 and xmlhttp.status = 200 then%>
XML Parse Error:
File Position: <%=xmlsource.parseError.filepos%>
Line: <%=xmlsource.parseError.line%>
Line Position: <%=xmlsource.parseError.linepos%>
Reason: <%=xmlsource.parseError.reason%>
Text: Line: <%=xmlsource.parseError.srctext%>
ErrorCode: <%=xmlsource.parseError.errorCode%>
URL: <%=xmlsource.parseError.URL%>
<% else
if xmlstatus="update" then
'Now update database with current feed.
rscache("xml")=xmlsource.xml
rscache("lastchecked")=now()
rscache.update
end if
end if
else
'Get XML from Cache in Database.
set xmlsource = Server.CreateObject("Microsoft.XMLDOM")
xmlsource.loadxml(rscache("xml"))
end if
set xmlstyle = Server.CreateObject("Microsoft.XMLDOM")
xmlstyle.load(styleFile)
getXML = xmlsource.transformNode(xmlstyle)
set xmlsource = nothing
set xmlstyle = nothing
End Function
%>
Jadeite Bracelets Imported China
Our designer Chinese jade bangle bracelets are the rarest and most unique find of jadeite bracelets. Some of the stone picked to make the Jade Jewerly date back to 120 b.c

|
<%=getXML(xmlrssfeed)%> |