随笔 - 8  文章 - 55  trackbacks - 0
<2006年5月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

常用链接

留言簿(6)

随笔分类

随笔档案

文章分类

文章档案

朋友的Blog

最新评论

阅读排行榜

评论排行榜

vbs类生成xml文件
[ 作者:  加入时间:2006-04-03 15:13:42  来自: ]
有两文件:
obj
XML . asp :测试文件
cls
XML . asp :vbs类文件
代码:
obj
XML . asp

<%@ Language=VBScript %>
<% Option Explicit %>
<!--#INCLUDE FILE="cls
XML . asp "-->
<%
Dim obj
XML , strPath, str
Set obj
XML = New cls XML

strPath = Server.MapPath(".") & "/New.xml"

obj XML .createFile strPath, "Root"
'Or If using an existing
XML file:
'obj
XML .File = "C:/File.xml"

obj XML .createRootChild "Images"

'Here only one attribute is added to the Images/Image Node
obj
XML .createChildNodeWAttr "Images", "Image", "id", "1"
obj
XML .updateField "Images//Image[@id=1]", "super.gif"
obj
XML .createRootNodeWAttr "Jobs", Array("Size", "Length", "Width"), _
Array(24, 31, 30)
obj
XML .createRootNodeWAttr "Jobs", Array("Size", "Length", "Width"), _
Array(24, 30, 29)
obj
XML .createRootNodeWAttr "Jobs", Array("Size", "Length", "Width"), _
Array(24, 31, 85)

'Notice that all three job nodes have size 24, all of those
'nodes will be updated
obj
XML .updateField "Jobs[@Size=24]", "24's"

'Notice that only two nodes have the specified XPath, hence
'only two new child nodes will be added
obj
XML .createChildNodeWAttr "Jobs[@Size=24 and @Length=31]", "Specs", _
Array("Wood", "Metal", "Color"), _
Array("Cedar", "Aluminum", "Green")

'It is always important to iterate through all of the nodes
'returned by this XPath query.
For Each str In obj
XML .getField("Jobs[@Size=24]")
Response.Write(str & "<br>")
Next
Set obj
XML = Nothing

Response.Redirect "New.xml"
%>

cls XML . asp :

<%
Class cls
XML
'strFile must be full path to document, ie C:/ XML / XML File. XML
'objDoc is the XML Object
Private strFile, objDoc

'*********************************************************************
' Initialization/Termination
'*********************************************************************

'Initialize Class Members
Private Sub Class_Initialize()
strFile = ""
End Sub

'Terminate and unload all created objects
Private Sub Class_Terminate()
Set objDoc = Nothing
End Sub

'*********************************************************************
' Properties
'*********************************************************************

'Set XML File and objDoc
Public Property Let File(str)
Set objDoc = Server.CreateObject("Microsoft.
XML DOM")
objDoc.async = False
strFile = str
objDoc.Load strFile
End Property

'Get XML File
Public Property Get File()
File = strFile
End Property

'*********************************************************************
' Functions
'*********************************************************************

'Create Blank XML File, set current obj File to newly created file
Public Function createFile(strPath, strRoot)
Dim objFSO, objTextFile
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(strPath, True)
objTextFile.WriteLine("<?xml version=""1.0""?>")
objTextFile.WriteLine("<" & strRoot & "/>")
objTextFile.Close
Me.File = strPath
Set objTextFile = Nothing
Set objFSO = Nothing
End Function

'Get XML Field(s) based on XPath input from root node
Public Function getField(strXPath)
Dim objNodeList, arrResponse(), i
Set objNodeList = objDoc.documentElement.selectNodes(strXPath)
ReDim arrResponse(objNodeList.length)
For i = 0 To objNodeList.length - 1
arrResponse(i) = objNodeList.item(i).Text
Next
getField = arrResponse
End Function

'Update existing node(s) based on XPath specs
Public Function updateField(strXPath, strData)
Dim objField
For Each objField In objDoc.documentElement.selectNodes(strXPath)
objField.Text = strData
Next
objDoc.Save strFile
Set objField = Nothing
updateField = True
End Function

'Create node directly under root
Public Function createRootChild(strNode)
Dim objChild
Set objChild = objDoc.createNode(1, strNode, "")
objDoc.documentElement.appendChild(objChild)
objDoc.Save strFile
Set objChild = Nothing
End Function

'Create a child node under root node with attributes
Public Function createRootNodeWAttr(strNode, attr, val)
Dim objChild, objAttr
Set objChild = objDoc.createNode(1, strNode, "")
If IsArray(attr) And IsArray(val) Then
If UBound(attr)-LBound(attr) <> UBound(val)-LBound(val) Then
Exit Function
Else
Dim i
For i = LBound(attr) To UBound(attr)
Set objAttr = objDoc.createAttribute(attr(i))
objChild.setAttribute attr(i), val(i)
Next
End If
Else
Set objAttr = objDoc.createAttribute(attr)
objChild.setAttribute attr, val
End If
objDoc.documentElement.appendChild(objChild)
objDoc.Save strFile
Set objChild = Nothing
End Function

'Create a child node under the specified XPath Node
Public Function createChildNode(strXPath, strNode)
Dim objParent, objChild
For Each objParent In objDoc.documentElement.selectNodes(strXPath)
Set objChild = objDoc.createNode(1, strNode, "")
objParent.appendChild(objChild)
Next
objDoc.Save strFile
Set objParent = Nothing
Set objChild = Nothing
End Function

'Create a child node(s) under the specified XPath Node with attributes
Public Function createChildNodeWAttr(strXPath, strNode, attr, val)
Dim objParent, objChild, objAttr
For Each objParent In objDoc.documentElement.selectNodes(strXPath)
Set objChild = objDoc.createNode(1, strNode, "")
If IsArray(attr) And IsArray(val) Then
If UBound(attr)-LBound(attr) <> UBound(val)-LBound(val) Then
Exit Function
Else
Dim i
For i = LBound(attr) To UBound(attr)
Set objAttr = objDoc.createAttribute(attr(i))
objChild.SetAttribute attr(i), val(i)
Next
End If
Else
Set objAttr = objDoc.createAttribute(attr)
objChild.setAttribute attr, val
End If
objParent.appendChild(objChild)
Next
objDoc.Save strFile
Set objParent = Nothing
Set objChild = Nothing
End Function

'Delete the node specified by the XPath
Public Function deleteNode(strXPath)
Dim objOld
For Each objOld In objDoc.documentElement.selectNodes(strXPath)
objDoc.documentElement.removeChild objOld
Next
objDoc.Save strFile
Set objOld = Nothing
End Function
End Class
%>

posted @ 2006-06-06 13:04 blog搬家了--[www.ialway.com/blog] 阅读(414) | 评论 (0)编辑 收藏

www.nike.com

www.m5.icoke.com

http://www.hcgjhotel.com/

http://www.peugeot.com.cn/web/307/

http://www.kingnare.com/

http://www.greenovia.net/

http://www.blueidea.com/bbs/newsdetail.asp?page=4&id=1935698&Daysprune=&lp=1

http://www.5dmax.com/

http://www.skii.com.cn/pitera/index.html

http://www.daphne.com.cn/d28/

http://www.wangbao.com.cn/main.html

http://www.mystvgame.com/us/

http://land.anycall.com/event/anyclub2/event_main.jsp

http://www.gglc.com.cn/main.htm

http://www.boyaguoji.com/index1.htm

www.superaction.co.kr

posted @ 2006-06-03 21:34 blog搬家了--[www.ialway.com/blog] 阅读(394) | 评论 (0)编辑 收藏
QQ骂人宝典7
作者:未知 来源:99软件站 加入时间:2004-8-28 飞牌精品软件
 
男人的四大理想:天上纷纷掉钞票,天下美男都死掉,美女脑子都坏掉,哭着喊着让我泡.

丑女一回头,吓死一头牛;丑女二回头,黄河瀑布水倒流;丑女三回头,泰森改打乒乓球!

男人四怕:怕小姐有病,怕情人怀孕,怕群众写信,怕老婆自尽。你怕啥?

这段日子以来,我一直想对你说三个字,但又怕说了连普通朋友也做不成,可我控制不住,还是想说:借点钱!

脑筋急转弯:一只猪过马路被车撞死了,为什么?告诉你吧,是猪不会急转弯。

老婆无味,情人太累,小姐太贵,没事开个同学会,拆散一对是一对

克林顿睡觉是国睡 乞丐睡觉是地税 和老婆睡觉是依法纳税 和情人睡觉是偷税漏税 和小姨子睡觉是增值税

读出下面的字,你将获得月薪2000000的工作,试题如下:簟璁醭歙艽绱癀穑魍旃偬彘硪钚鲥硐蓰。

警告。你的手机由于黑客侵入信号系统,电池即将被引爆。请立即将手机电池取下扔出五米距离。切切。

兄弟!请不要在每次放屁后低头猛吸就以为能把屁味吸光!:p

啊!你的皮肤如此富有光泽,你散发的香味如此难以抗拒,让我狠狠咬你一口吧,我亲爱的--红烧肉。

人家捞,你不捞,老婆说你是草包;人家赌,你不赌,背后说你二百五;人家嫖,你不嫖,大伙一起造你谣

人生四大悲:久旱逢甘霖-不停;他乡遇故知-借钱;洞房花烛夜-不举;金榜题名时-别人

猪的四大愿望:四周栅栏都倒掉,天上纷纷掉饲料。天下屠夫都死掉,世界人民信佛教。

天大地大不如老婆大;爹亲娘亲不如小姐亲;千好万好不如二奶好!

只爱一个有点傻,爱上两个最起码,三个五个刚合适,十个八个才潇洒。

山外青山楼外楼,你不爱我我不愁。世上美女到处有,她会比你更温柔!

投保:男朋友是准客户,老公是客户,结婚是签单,离婚是退保,再婚是续保,找老二是加保  

这是有“屎”以来最有“粪”量的祝福

有三个字一直藏在我的心底不敢对你说。现在我终于鼓足了勇气:“去死吧!”  

那天我看见你拿到狂砍一只猪,猪跑到一个死胡同,只听见猪大叫:“本是同根生,相煎何太急!”

你如果收到本信息,证明你手机以感染病毒,请马上取出手机卡,用汽油刷洗。

网上无计可消愁,聊天解烦忧,忽见美眉在招手,顿首顿首,关掉其他窗口,聊到最后,是一北方老叟,作呕作呕!

不许动!抢劫!全部举起手来!男的站左边,女的站右边,变态的站中间,哎!说的就是你,还装着看手机!

美眉美眉我爱你!先用话语感动你,再用行动打动你,买个戒指送给你,再用劳斯莱斯去娶你!(你愿意吗?)

嫖客:万水千山总是情,少给十块行不行;妓女:人间哪有真情在,多赚十块是十块。

有一个女生去牧场见习挤牛奶,可别人都挤了一桶了,她还只挤了一点,正着急,突然老牛说了:小姐,你挤错地方了!

强匪发现保险柜里头全都是果冻,他一气之下,把所有果冻都吃掉。隔天报纸的头条是这么写的 ※疯狂歹徒,精子银行被盗※

猎人发现一只猪,举起猎枪打死了猪,猎人走近猪,猪却起来了,知道为什么?猜不到?—猪也正纳闷呢。

男人最渴望的一句话:“我要”;男人最恐惧的一句话:“我还要嘛”

请走到最近的电线杆前面,对着上面的野广告大声说“我的病有救了”

你比镜子还能反映我的缺点,你比庄子还博学多才,你比孙子还有谋略。所以我们都亲切的叫你:“镜庄孙子”。

网上自古少娇娘,歪瓜裂枣排成行,偶尔几声鸳鸯叫,也是淫女配色狼. 
posted @ 2006-05-31 12:46 blog搬家了--[www.ialway.com/blog] 阅读(838) | 评论 (0)编辑 收藏