CSDN博客

img snowdot23

在domino中应用RSS

发表于2004/7/5 16:19:00  707人阅读

参照rss2.0写了发布rss的两个类
 Class Rss
  Private strRdfLiResource As String
  Private strH As String
  Private strAbout As String
  Private strlink As String
  Private strTitle As String
  Private strdescription As String
 
  Sub New()
  
  End Sub
  Property Set about As Variant
   strAbout=about
  End Property
 
  Property Set title As Variant
   strTitle=title
  End Property
  Property Set description As Variant
   strDescription=description
  End Property
  Property Set link As Variant
   strLink=link
  End Property
 
  Private Function getChannel() As String
   Dim strRss As String
   strRss=|<channel rdf:about="|+strAbout+|">|
   strRss=strRss+|<channel rdf:about="|+strAbout+|">|
   strRss=strRss+|<title>|+strtitle+|</title> |
   strRss=strRss+| <description>|+strdescription+|</description> |
   strRss=strRss+| <link>|+strlink+|</link> |
   ''strRss=strRss+|<image rdf:resource="http://192.198.64.36/video.nsf/dqgl_ajla.gif"  /> |
   strRss=strRss+|<items>|
   strRss=strRss+|<rdf:Seq>|
   strRss=strRss+strRdfLiResource
   strRss=strRss+|</rdf:Seq>|
   strRss=strRss+|</items>|
   strRss=strRss+|</channel>|
  End Function
  Public Function toXML()
   Dim strItemXml As String
   Print "Content-type: text/xml"
   Print  |<?xml version="1.0" encoding="GB2312"?>|
   Print  | <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  |
  
   Print  |xmlns:dc="http://purl.org/dc/elements/1.1/"  |
  
   Print  |xmlns:foaf="http://xmlns.com/foaf/0.1/"  |
  
   Print  |xmlns="http://purl.org/rss/1.0/"  >|
   strItemXml= getChannel()
   Print strItemXml
   Print |</rdf:RDF>|
  End Function
  Public Sub addItem(rssItem As Variant)
   strH=strh+rssItem.getXml()
   strRdfLiResource=rssItem.about
  End Sub
 
 
  Function Valiater() As Boolean
   Dim isflag As Boolean
   isflag=True
   If strRdfLiResource="" Then
    isflag=False
   End If
   If strabout ="" Then
    isflag=False
   End If
   Valiater=isflag
  End Function
 End Class

 

 Class Rssitem
  Private strXml As String
  Private strAbout As String
  Private strTitle As String
  Private strLink As String
  Private strDescription As String
  Private strDate As String
  Private strCreator As String
  Private strResouce As String
  Private strCreateDate As String
  Private strAuthorMail As String
 
 
 
  Sub New()
   strDate=Now
  
  End Sub
  Property Set about As String
   strAbout=about
  End Property
  Property Get about As String
   about=strAbout
  End Property
  Property Set title As String
   strtitle=title
  End Property
  Property Set link As String
   strlink=link
  End Property
 
  Property Set description As String
   strdescription =description
  End Property
 
  Property Set date As String
   strdate=Date
  End Property
 
  Property Set creator As String
   strcreator=creator
  End Property
 
  Property Set resouce As String
   strresouce=resouce
  End Property
 
  Property Set createDate As String
   strcreateDate= createDate
  End Property
 
 
  Property Set authorMail As String
   strauthorMail=authorMail
  End Property
 
 
  Function getXML() As String
   Call createXml()
   getXML=strXml
  End Function
  Private Sub createXml()
   Dim strH As String
   strH=|<item rdf:about="|+strAbout+|">|
  
   strH=strH+|<title>|+strTitle+|</title> |
   strH=strH+|<link>|+strLink+|</link> |
   strH=strH+|<description>|+strDescription+|</description> |
   strH=strH+|<dc:date>|+strDate+|</dc:date> |
   strH=strH+| <dc:creator>|+strCreator+|</dc:creator> |
   strH=strH+|<foaf:maker>|
   strH=strH+| <foaf:Person>|
   strH=strH+|<foaf:mbox rdf:resource="|+strAuthorMail+|" /> |
   strH=strH+|</foaf:Person>|
   strH=strH+|</foaf:maker>|
   strH=strH+|</item>|
   strXml=strH
  
  
  End Sub
  Function Valiater() As Boolean
   Dim isflag As Boolean
   isflag=True
   If strAbout="" Then
    isflag=False
   End If
   If strLink="" Then
    isflag=False
   End If
   If strTitle="" Then
    isflag=False
   End If
   Valiater=isflag
  End Function
 
 
 
 
 End Class
 具体使用在下一节

 

0 0

相关博文

我的热门文章

img
取 消
img