ASP RSS Parser, Okuphakelayo Reader

Ama-Depositphotos 4651719 s

Kule mpelasonto nginamathiselwe kwi-laptop yami ngisesha inetha labafundi be-RSS feed abafundi abasuselwa kuwebhu. Isizathu ukuthi bengifuna ukubhala i-asp RSS feed reader ezokhombisa okuphakelayo ukuze okuqukethwe kungasuswa ngokuzenzekelayo ku-imeyili ye-HTML. Ngakho-ke kubantu abafuna ukubekisa ingxenye yencwajana yabo ye-imeyili yeBlog yabo noma izindatshana zokushicilelwa, ingahlanganiswa kalula. Njengoba iJavaScript empeleni ingakhombisi okuqukethwe kuze kube yilapho iklayenti lilayisha futhi lisebenzisa iskripthi, ubuningi beziphequluli zeJavaScript RSS abuzange busizakale. Bengidinga isifundi sohlangothi lwe-RSS feed reader.

Ngaqala ngokubhala i-parser yami ku-ASP ngisebenzisa into ye-MSXML. Ngikwazile ukuhlwaya cishe ama-75% we-RSS feeds enza lokhu, kepha okunye ukucaciswa kweXML okuxekethile kuma-RSS feeds kube nzima kakhulu ukuwahlela. Ungayibona isebenza lapha. Ungadlulisa inani eliphakeme lezinto (ni), inani lezinhlamvu ezisikiwe egameni (nc), kanye ne-URL. Ungabona futhi okuphakelayo kwangempela ngokuhlukahluka kokulungisa iphutha lapha.

Okuphakelayo okuningi kwe-RSS 'kungcolile' impela futhi kudinga ukwehlukanisa umbhalo kufayela le-XML ngekhodi yokukhohlisa ngentambo (ugh!). Vele, sisese 'kwentsha' yethu ye-RSS enetheni ngakho-ke angimangazi. Funda kabanzi mayelana nokucaciswa kwe-RSS lapha.

Ekugcineni, ngathola igugu elincane. Ngithole isigaba samahhala se-ASP esingasilanda. Ihamba kancane, kepha angikatholi okuphakelayo ebingakwazi ukukufunda. Ngine-static version lapha nenguqulo enamandla lapha.

Amanothi ambalwa embhalweni. Bengidinga ukusula amanye amathegi we-HTML encazelweni ezibuyisiwe. Ngikwenze lokho ngomsebenzi omncane wokuhlanza engiwutholile:

Umsebenzi Susa i -HTML (strText) Dim nPos1 Dim nPos2 nPos1 = InStr (strText, ">") Yenza Ngenkathi nPos1> 0 nPos2 = InStr (nPos1 + 1, strText, ">") Uma nPos2> 0 Bese strText = Kwesobunxele (strText, nPos1 - 1) & Mid (strText, nPos2 + 1) Else Exit Do End If nPos1 = InStr (strText, ">") Loop SusaHTML = strText End Function

Ngibuye ngangeza enye ikhodi encane ecocekile: Kwesinye isikhathi, ngingahle ngifune ukukhombisa incazelo engaphezulu noma encane. Kodwa-ke, uma ngimane ngilinganisela inani labalingiswa, khona-ke ngingahle ngiyinqume incazelo phakathi kwegama. Angifuni ukwenza lokho!

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

(Ngibe nezinkinga ezithile ngokubonisa ikhodi yami kahle kulokhu kungena… ungazise uma unezinkinga ngomunye wale misebenzi!)

Ngibonile amanye amathuluzi ambalwa enetheni futhi. Kukhona I
.NET version, izinhlobo eziningi ze-PHP, ithoni yezinguqulo zeJavaScript.

Ukuphetha, ngithemba ukuthi ukucaciswa kwe-RSS kuyaqhubeka nokuhlanjululwa futhi okuphakelayo uqobo kuhambisana namazinga weXML kuwo wonke amacala. Izicelo zamahhala ezifana ne-TypePad, WordPress, njll zidinga ukwenza ngcono ukusebenza kwazo kwe-RSS. Amabhulogi angeziwe afana ne-MySpace, i-Xanga, i-LiveJournal, njll. Adinga ukuthuthukisa ukusebenza kwawo kwe-RSS. I-RSS inamandla…UChris Baggott ubhale ucezu oluhle ku-imeyili vs. RSS. Ngicabanga ukuthi ukuhlanganisa ukusebenza kwabo kungakhuphula umthelela wabo bobabili!

UCABANGANI?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda ukuthi idatha yakho yokuphawula isetshenziswa kanjani.