class blogwritedim blogfsowritePrivate Sub Class_Initializeset blogfsowrite = new blogfsoend subfunction blogsetup (blogname1, blogfolder1, blogxsltvalue, shownumpage1, sourcef) dim theyear, themonth xmlstr = " xml version = '1.0' encoding = 'gb2312'?>" xmlstr = xmlstr & "
Blogfsowrite.fsocreatef "c: /bloginfo.xml", 1 blogfsowrite.fsowrite xmlstr, "c: /bloginfo.xml" xmlstr = " XML version = '1.0' encoding = 'GB2312'?>" Xmlstr = Xmlstr & " xml-stylesheet type = 'text / xsl' href = 'blueone.xsl'?> "xmlstr = xmlstr &"
Fsooprsrc = sourcef & "fsoperation.vbs" fsooprdes = blogfolder1 & "fsooperation.vbs"
FSOBLOGWRSRC = Sourcef & "Blogwrite.vbs" fsoblogwrdes = blogfolder1 & "blogwrite.vbs"
Fsoxmlhttpsrc = sourcef & "xmlhttprequest.vbs" fsoxmlhttpdes = blogfolder1 & "xmlhttprequest.vbs"
FSOBLUEONESRC = Sourcef & "BlueOne.xsl" fsoblueonedes = blogfolder1 & "blueone.xsl"
FsoCalendarsrc = Sourcef & "Calendar.vbs" fsocalendardes = blogfolder1 & "calendar.vbs"
Fsoxmldomsrc = sourcef & "xmldom.vbs" fsoxmldomdes = blogfolder1 & "xmldom.vbs"
Fsoblogxmldomsrc = sourcef & "blogxmldom.vbs" fsoblogxmldomdomdomdes = blogfolder1 & "blogxmldom.vbs"
Fsomainsrc = Sourcef & "Main.vbs" fsomaindes = blogfolder1 & "main.vbs"
FsoIndexsrc = Sourcef & "Index.htm" fsoIndexdes = blogfolder1 & "index.htm"
blogfsowrite.fsocopyf fsooprsrc, fsooprdes, 1 blogfsowrite.fsocopyf fsoblogwrsrc, fsoblogwrdes, 1 blogfsowrite.fsocopyf fsoxmlhttpsrc, fsoxmlhttpdes, 1 blogfsowrite.fsocopyf fsoblueonesrc, fsoblueonedes, 1 blogfsowrite.fsocopyf fsocalendarsrc, fsocalendardes, 1 blogfsowrite.fsocopyf fsoxmldomsrc, fsoxmldomdes, 1 blogfsowrite. fsocopyf fsomainsrc, fsomaindes, 1 blogfsowrite.fsocopyf fsoblogxmldomsrc, fsoblogxmldomdes, 1 blogfsowrite.fsocopyf fsoindexsrc, fsoindexdes, 1end functionfunction newblog (blogtitle, blogcontent, blogshownum, blogfolder1) xmlstr = " xml version = '1.0' encoding = 'gb2312'? > "Xmlstr = Xmlstr &"
" Link>" xmlstr1 = xmlstr1 & "
/ Blogtitle> "xmlstr1 = xmlstr1 &"
set blogbasxml = new xmldom blogbasxml.openxml "c: /bloginfo.xml" blogbasxml.ebloginfo blogtitle, blogfilename set blogmxml = nothing end if end if blogfsowrite.fsocreatef blogfilename, 1 blogfsowrite.fsowrite xmlstr, blogfilenameend function
END CLASS
Class Xmldomdim TheXmldomprivate Sub Class_Initializset Thexmldom = CreateObject ("Microsoft.xmLDom") End Sub
Public function openxml (Thefile) THEXMLDOM.ASYNC = false theXmldom.load thefilend function
Public Function itemlen (Tag) set itemhes = THEXMLDOM.GETELEMENTSBYTAGNAME (TAG) itemlen = itemhes.LengthThend Function
public function additemblogm (blogtitle, blogcontent, thelink, thefile) set addroot = thexmldom.createElement ( "blog") set root = thexmldom.documentElement set currnode = root.insertBefore (addroot, root.childNodes (0)) currnode.setAttribute "date ", date currnode.setAttribute" time ", time set blogtitleadd = thexmldom.createElement (" blogtitle ") set blogtitled = currnode.appendchild (blogtitleadd) blogtitled.text = blogtitle set blogcontentadd = thexmldom.createElement (" blogcontent ") set blogcontentd = currnode.appendchild (blogcontentadd) blogcontentd.text = blogcontent set bloglinkadd = thexmldom.createElement ( "link") set bloglinkd = currnode.appendchild (bloglinkadd) bloglinkd.text = thelink set blogcommentadd = thexmldom.createElement ( "comment") currnode.appendchild BlogcommentAdd thexmldom.save the thefilend function
public function addrecentxml set root = thexmldom.documentElementset addroot = thexmldom.createElement (blogtitle, blogcontent, thelink, thefile, blogshownum) ( "blog") if root.childNodes.length = 0 then set currnode = root.appendchild (addroot) else set currnode = root.insertBefore (addroot, root.childNodes (0)) end ifif root.childNodes.length = blogshownum then root.removeChild root.lastchildend if currnode.setAttribute "date", date currnode.setAttribute "time", time set blogtitleadd = thexmldom.createElement ( "blogtitle") set blogtitled = currnode.appendchild (blogtitleadd) blogtitled.text = blogtitle set blogcontentadd = thexmldom.createElement ( "blogcontent") set blogcontentd = currnode.appendchild (blogcontentadd) blogcontentd.text = blogcontent set bloglinkadd = thexmldom.createElement ( "link") set bloglinkd = currnode.appendchild (bloglinkadd) bloglinkd.text = thelink set blogcommentadd = thexmldom.createElement ( "comment") currnode.appendchild blogcommentadd thexmldom.save thefileend function
function showblogxml () set blogroot = thexmldom.getElementsByTagName ( "blog") bloglen = blogroot.lengthfor i = 0 to bloglen-1 if i = 0 then str = "
" thedate = blogroot.item (i) .GetaTribute ("date") str = str & theirdate & " td> tr>" else thedate1 = blogroot.item (i) .getattribute ("date") if thede <> these1 Twate = THEDATE1 STR = STR & THEDATE & " TD> TR>" end if end if str = str & " |
" & blogroot.item (i) .childNodes (0) .text & "< Br /> "& blogroot.item (i) .childnodes (1) .text &" td> tr> "str = str &" |
Link Address td> tr>" Nextif Bloglen <> 0 Then Str = str & " table>" end ifshowblogxml = strend functionFunction ebloginfo (blogtitle, thelink) set blogroot = thexmldom.getElementsByTagName ( "blogall") set currnode = thexmldom.createElement ( "blog") bloglen = blogroot.childNodes.lengthif bloglen = 0 then set blogcur = blogroot.appendchild (currnode) else set Blogcur = blogroot.inser tBefore (currnode, blogroot.firstchild) end if blogcur.setAttribute "link", thelink blogcur.setAttribute "title", blogtitle blogcur.setAttribute "date", date blogcur.setAttribute "time", time end function
Private sub coplass_terminate set theXmldom = Nothing end SUB END CLASS |