ASP RSS Cov Parser, Pub Nyeem

Depositphotos 4651719 s

Lub asthiv no Kuv tau txais ntsej muag rau kuv lub laptop tshawb hauv net rau web-based RSS pub nyeem. Qhov laj thawj yog tias kuv xav sau ntawv asp RSS pub nyeem ntawv uas yuav tso tawm cov khoom noj kom cov ntsiab lus tuaj yeem raug txiav mus rau hauv HTML email. Yog li rau cov pej xeem uas xav tseg ib feem ntawm lawv cov ntawv xov xwm email rau lawv cov Blog lossis Cov Ntawv Tshaj Tawm, nws tuaj yeem siv tau yooj yim. Txij li thaum JavaScript tsis tau tso tawm cov ntsiab lus kom txog thaum tus neeg siv khoom thau tawm thiab sau tsab ntawv, lub plethora ntawm JavaScript RSS browsers tsis muaj txiaj ntsig. Kuv xav tau server-sab RSS pub nyeem ntawv.

Kuv pib los ntawm kev sau kuv tus kheej parser hauv ASP uas siv MSXML yam. Kuv tau parse txog 75% ntawm RSS txau ua qhov no, tab sis qee qhov xoob ntawm XML cov ntsiab lus ntawm RSS ua pov thawj pom tias nyuaj rau qhov kev zov me nyuam. Koj tuaj yeem pom nws hauv kev nqis tes ua noCov. Koj tuaj yeem xeem dhau tus lej ntawm cov khoom (ni), tus naj npawb ntawm cov cim txiav ntawm lo lus (nc), nrog rau URL. Koj tuaj yeem pom cov zaub mov tiag tiag nrog lub debug sib txawv no.

Ntau RSS pub khoom yog tiag tiag 'qias neeg' thiab xav tau parsing cov ntawv hauv XML ntawv nrog cov hlua manipulation code (ugh!). Tau kawg, peb tseem nyob hauv peb RSS 'cov hluas' hauv net yog li kuv tsis xav tsis thoob. Nyeem ntxiv txog RSS specifications no.

Thaum kawg, Kuv tuaj hla lub pov haum me me. Kuv pom ib chav kawm dawb ASP mus rub tawm. Nws tau qeeb me ntsis, tab sis kuv tsis tau pom ib qho kev pub mov uas nws nyeem tsis tau ntawv. Kuv tau txais ib qho qauv zoo li qub ntawm no thiab tus qauv hloov ntawm no.

Ob peb tsab ntawv sau rau ntawm tsab ntawv. Kuv puas tau xav tshem tawm qee cov HTML cim npe hauv cov lus piav qhia rov qab. Kuv tau ua li ntawd nrog kev ua kom me me kev tu kuv pom:

Kev Ua Tawm Tshem TawmHTML (strText) Dim nPos1 Dim nPos2 nPos1 = InStr (strText, ">") Ua Thaum nPos1> 0 nPos2 = InStr (nPos1 + 1, strText, ">") Yog nPos2> 0 Tom qab ntawd strText = Sab laug (strText, nPos1 - 1) & Mid (strText, nPos2 + 1) Lwm Txoj Kev Tshem Tawm Yuav Kawg Yog tias nPos1 = InStr (strText, ">") Ntxees RemoveHTML = strText End Ua Haujlwm

Kuv kuj ntxiv ib qho zoo me ntsis ntawm kev cai: qee zaum, Kuv yuav xav tso tawm ntau dua los yog tsawg dua ntawm cov lus piav qhia. Txawm li cas los xij, yog tias kuv tsuas txwv tus naj npawb ntawm cov cim, tom qab ntawd kuv yuav txiav cov lus piav qhia hauv nruab nrab ntawm lo lus. Kuv tsis xav ua li ntawd!

Function Cutoff (strText, intChars) dim intLength dim j intLength = len (strText) yog intChars> intLength ces rau j = intChars rau 0 kauj ruam -1 yog tias nruab nrab (strText, j, 1) = "" ces tawm rau tom ntej yog j 0 ces strText = sab laug (strText, j-1) & "..." lwm strText = strText kawg yog tas yog Cutoff = strText kawg Ua Haujlwm

(Kuv muaj qee yam teeb meem nrog kev tso saib kuv cov cai kom nkag rau hauv cov khoom nkag no… qhia rau kuv paub yog tias koj muaj teeb meem nrog ib qho ntawm cov haujlwm no!)

Kuv tau pom ob peb yam cuab yeej ntxiv rau hauv net zoo ib yam. Muaj tus
.NET version, ntau hom PHP, ib tuj ntawm JavaScript hloov.

Los xaus, Kuv vam tias RSS cov ntsiab lus txuas ntxiv tau raug kho kom zoo thiab qhov tseeb txau ua raws cov qauv XML txhua qhov xwm txheej. Cov ntawv thov pub dawb xws li TypePad, WordPress, thiab lwm yam yuav tsum ua kom zoo dua lawv cov haujlwm RSS. Cov blogs ntxiv xws li MySpace, Xanga, LiveJournal, thiab lwm yam yuav tsum txhim kho lawv cov haujlwm RSS. RSS Yog haib…Chris Baggott sau tau zoo thooj ntawm Email vs. RSS. Kuv xav tias ua ke nrog lawv cov haujlwm yuav ua rau muaj kev cuam tshuam ntawm ob qho!

Yuav ua li cas koj xav hais tias?

Qhov Web site no siv Akismet los txo cov kev pabcuam. Kawm li cas koj cov ntaub ntawv tawm tswv yim tiav.