Umgcini we-ASP RSS, uMfundi weSondlo

Iidipozithi iifoto 4651719 s

Kule mpelaveki bendincamathele kwilaptop yam ndikhangela umnatha kubafundi abasisiseko se-RSS feed feed. Isizathu kukuba bendifuna ukubhala i-asp RSS feed reader eya kuthi ibonise ukondla ukuze umxholo unokukhutshelwa ngokuzenzekelayo kwi-imeyile ye-HTML. Ke abantu abafuna ukugcina inxenye yeeleta zeendaba ze-imeyile zebhlog zabo okanye amanqaku apapashiweyo, inokufakwa ngokulula. Kuba iJavaScript ayibonisi umxholo de umlayishi alayishe kwaye enze iskripthi, ubuninzi bezikhangeli zeJavaScript ze-RSS bezingancedi. Ndidinga iseva yecala le-RSS feed feed.

Ndiqale ngokubhala eyam i-parser kwi-ASP ndisebenzisa into ye-MSXML. Ndikwazile ukwahlula malunga ne-75% ye-RSS feed esenza oku, kodwa ezinye zeempawu zeXML ezikhululekileyo kwi-RSS feeds zibonakalise zinzima kakhulu kwinkqubo. Ungayibona isebenza Apha. Ungalidlulisa elona nani liphezulu lezinto (ni), inani labalinganiswa abasikiweyo kwigama (nc), kunye ne-URL. Unokubona ukutya okwenyani ngokwahluka kokulungisa ingxaki Apha.

Uninzi lweempendulo ze-RSS ngokwenene 'zimdaka' kwaye zifuna ukwahlula isicatshulwa kwifayile yeXML ngekhowudi yokuphatha umtya (ugh!). Ewe kunjalo, sikwi-RSS yethu 'yolutsha' kumnatha andothuki. Funda ngakumbi malunga neenkcukacha zeRSS Apha.

Ekugqibeleni, ndafumana ilitye elinqabileyo. Ndifumene iklasi yasimahla ye-ASP yokukhuphela. Iyacotha kancinci, kodwa andifumananga fidi ibingakwazi ukuyifunda. Ndinenguqulo emileyo apha kunye nohlobo olunamandla apha.

Isibini esibhaliweyo kwisikripthi. Ndidinge ukucima ezinye iithegi ze-HTML kwinkcazo ebuyisiweyo. Ndiyenzile ngomsebenzi omncinci wokucoca endiwufumeneyo:

Umsebenzi SusaHTML (strText) Dim nPos1 Dim nPos2 nPos1 = InStr (strText, ">")) Yenza nPos1> 0 nPos2 = InStr (nPos1 + 1, strText, ">") Ukuba nPos2> 0 Ke strText = Ekhohlo (strText, nPos1 - 1) & Mid (strText, nPos2 + 1) Else Exit Do End If nPos1 = InStr (strText, ">") Loop SusaHTML = strText End Function

Ndongeze enye ikhowudi ecocekileyo encinci: Ngamanye amaxesha, ndingafuna ukubonisa inkcazo engaphezulu okanye encinci. Nangona kunjalo, ukuba ndinciphisa inani labalinganiswa, ndingayinqumla inkcazo embindini wegama. Andifuni ukuyenza loo nto!

Umsebenzi cutoff (strText, intChars) dim intLength dim j intLength = len (strText) ukuba intChars> intLength emva koko j = intChars to 0 step -1 if mid (strText, j, 1) = "" then exit for next if j> 0 emva koko strText = left (strText, j-1) & "..." else strText = strText end if end if Cutoff = strText End Function

(Ndinengxaki ekubonakaliseni ikhowudi yam ngokuchanekileyo kolu ngeno… undazise ukuba unengxaki nangawo omnye wale misebenzi!)

Ndiqaphele ezinye izixhobo ezimbalwa kumnatha ngokunjalo. Kukho i
.NET Inguqulelo, iinguqulelo ezininzi ze-PHP, itoni yeenguqulelo zeJavaScript.

Ukuqukumbela, ndiyathemba ukuba ukucaciswa kwe-RSS kuyaqhubeka nokucokiswa kwaye okona kutya kuyahambelana nemigangatho yeXML kuzo zonke iimeko. Izicelo zasimahla ezinje ngeTypePad, iWordPress, njl. Njl. Iiblogi ezongeziweyo ezinje nge-MySpace, iXanga, i-LiveJournal, njl njl kufuneka ziphucule ukusebenza kwazo nge-RSS. I-RSS inamandla…UChris Baggott ubhale isiqwenga esihle kwi-imeyile ngokuchasene neRSS. Ndicinga ukuba ukudibanisa ukusebenza kwabo kungonyusa ifuthe kubo bobabini!

Ingaba ucinga ntoni?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda indlela idatha yakho yokubhaliweyo isetyenziswe ngayo.