ASP RSS Parser, Kudya Kwekuverenga

Depositphotos 4651719 s

Vhiki ino ndakanamatirwa palaptop yangu ndichitsvaga mambure ewebhu-based RSS feed vaverengi. Icho chikonzero ndechekuti ini ndaida kunyora iyo asp RSS feed muverengi iyo yaizoratidza iyo feed kuitira kuti zvirimo zvive zvinongoerekana zvatsvairwa mu HTML email. Saka kune vanhu vanoda kuchengetera chikamu chetsamba yavo yeemail yavo yeBlog kana Zvinyorwa Zvekuburitswa, zvinogona kuve nyore kuiswa. Sezvo JavaScript isinganyatso kuratidza zvirimo kudzamara mutengi atakura uye nekuita script, iyo plethora yeJavaScript RSS mabhurawuza haina kubatsira. Ini ndaida server-parutivi RSS feed muverengi.

Ini ndakatanga nekunyora yangu pachangu muASP ndichishandisa chinhu cheMSXML. Ini ndakakwanisa kuenzanisa nezve 75% yeRSS feeds ichiita izvi, asi zvimwe zvakasununguka XML zvirevo paRSS feeds zvakaratidza kuve zvakaoma kwazvo kuronga. Unogona kuzviona muchiita pano. Unogona kupfuudza iyo max nhamba yezvinhu (ni), huwandu hwevatambi hwakatemwa pazwi (nc), pamwe neiyo URL. Iwe unogona zvakare kuona iyo chaiyo feed ine debug kusiyanisa pano.

Mazhinji maRSS feeds ari chaizvo 'akasviba' uye anoda kupatsanura iwo mavara muXML faira netambo yekumanikidza kodhi (ugh!). Ehezve, isu tichiri muRSS yedu 'hudiki' pamambure saka handishamiswe. Verenga zvimwe nezve RSS zvirevo pano.

Pakupedzisira, ndakasangana nedombo diki. Ndakawana yemahara ASP kirasi kurodha pasi. Inononoka zvishoma, asi ini handina kuwana chikafu icho chakatadza kuverenga. Ndine static vhezheni pano uye ine simba vhezheni pano.

Mapepa maviri pa script. Ini ndaida kujekesa mamwe maHTML eHTML mune dzakadzoserwa rondedzero. Ini ndakazviita nebasa diki rekuchenesa randakawana:

Basa BvisaHTML (strText) Dim nPos1 Dim nPos2 nPos1 = InStr (strText, ">") Ita Kunyange nPos1> 0 nPos2 = InStr (nPos1 + 1, strText, ">") Kana nPos2> 0 Wobva strText = Kuruboshwe (strText, nPos1 - 1) & Mid (strText, nPos2 + 1) Else Exit Do End Kana nPos1 = InStr (strText, ">") Loop BvisaHTML = strText End Basa.

Ini ndakawedzera imwe yakatsvinda zvishoma kodhi yekodhi: Dzimwe nguva, ini ndinogona kuda kuratidza yakawanda kana shoma tsananguro. Nekudaro, kana ndikangogumira huwandu hwevatambi, ipapo ndinogona kubvisa rondedzero iri pakati peshoko. Ini handidi kuita izvozvo!

Basa Cutoff (strText, intChars) dim intLength dim j intLength = len (strText) kana intChars> intLength ipapo ye j = intChars kusvika 0 nhanho -1 kana pakati (strText, j, 1) = "" wobva wabuda unotevera kana j> 0 wobva strText = kuruboshwe (strText, j-1) & "..." zvimwe strText = strText end if end kana Cutoff = strText End Basa.

(Ini ndaive nemamwe matambudziko nekuratidza kodhi yangu nenzira kwayo mune ino yekupinda… ndiudze kana uine matambudziko nechimwe chezviitiko izvi!)

Ndakaona mamwe maturusi mashoma pamambure futi. Iko kune
.com vhezheni, zhinji PHP shanduro, toni yeJavaScript shanduro.

Kupedzisa, ndinotarisira kuti RSS zvirevo zvinoramba zvichinatsiridzwa uye mafidha chaiwo anotevedzera zviyero zveXML mune zvese zviitiko. Mahara maapplication senge TypePad, WordPress, nezvimwe zvinoda kunatsiridza yavo RSS mashandiro. Mamwe mabloggi akaita seMySpace, Xanga, LiveJournal, nezvimwe zvinoda kuvandudza mashandiro eRSS. RSS IS powerful…Chris Baggott akanyora chidimbu chakanaka paemail vs. RSS. Ini ndinofunga kusanganisa mashandiro avo kunogona kuwedzera kukanganisa kwevaviri!

Unofungei?

Nzvimbo iyi inoshandisa Akismet kuderedza spam. Dzidza kuti sei deta yako inoshandiswa.