knowledge.XML文件
1<ebaihe id="gs000" name="Ebaihe" type="gs">
2<知识管理 name="知识管理" type="rt" id="rt000">
3<目录 name="vc++" type="ml" id="ml003"/>
4<目录 name="asp" type="ml" id="ml001">
5<知识 name="什么是ASP 1" type="zs" id="zs001">
6<title>什么是ASP</title>
7<author>cxx</author>
8<adddate>2001-02-20</adddate>
9<content>ASP:Active Server Page</content>
10<!--知识-->
11<知识 name="什么是ASP 2" type="zs" id="zs002">
12<title>什么是ASP</title>
13<author>cxx</author>
14<adddate>2001-02-20</adddate>
15<content>ASP:Active Server Page</content>
16<!--知识-->
17<!--目录-->
18<目录 name="vbs" type="ml" id="ml002">
19<知识 name="什么是vbs 1" type="zs" id="zs003">
20<title>什么是ASP</title>
21<author>cxx</author>
22<adddate>2001-02-20</adddate>
23<content>ASP:Active Server Page</content>
24<!--知识-->
25<知识 name="什么是vbs 2" type="zs" id="zs004">
26<title>什么是ASP</title>
27<author>cxx</author>
28<adddate>2001-02-20</adddate>
29<content>ASP:Active Server Page</content>
30<!--知识-->
31<!--目录-->
32<!--知识管理-->
33<留言簿 name="留言簿" type="ly" id="ly000">
34<单元 name="你好" type="dy" id="dy001">
35<留言 name="Who are you" type="zs" id="zs005">
36<title>什么是ASP</title>
37<author>cxx</author>
38<adddate>2001-02-20</adddate>
39<content>ASP:Active Server Page</content>
40<!--留言-->
41<留言 name="你好" type="zs" id="zs006">
42<title>什么是ASP</title>
43<author>cxx</author>
44<adddate>2001-02-20</adddate>
45<content>ASP:Active Server Page</content>
46<!--留言-->
47<!--单元-->
48<单元 name="我的留言" type="dy" id="dy003"/>
49<!--留言簿-->
50<留言簿 name="留言簿" type="ly" id="ly001"/>
51</ebaihe>
bianli.asp文件
1 @LANGUAGE=VBScript
1
2function getimgstr(ttid,ttname,ttlvl,tttype,ttlf,ttlstr)
3dim ttstr1
4if ttlvl=0 then
5ttstr1=ttstr1 & "
<a "="" "')"="" "','"="" "2"="" #"="" &="" call="" chr(34)="" href=" & chr(34) & " onclick=" & chr(34) & " onclickdiv('"="" ttid="" ttstr1="ttstr1">"
ttstr1= ttstr1 & "<img "="" &="" 0"="" border=" & chr(34) & " chr(34)="" computer.gif"="" height="16" image="" src=" & chr(34)
ttstr1= ttstr1 & "/>" & "</a>
1"
2ttstr1=ttstr1 & "
<a "="" "')"="" "','"="" "2"="" #"="" &="" call="" chr(34)="" href=" & chr(34) & " onclick=" & chr(34) & " onclickdiv('"="" ttid="" ttstr1="ttstr1">"
ttstr1=ttstr1 & ttname & "</a>
<br/>
1" & vbcrlf
2ttstr1=ttstr1 & "
<div id=" & chr(34) & ttid & chr(34) & " style="display:none">" & vbcrlf
else
for i= 2 to len(ttlstr)-1
if mid(ttlstr,i,1)="1" then
ttstr1 = ttstr1 & "<img "="" &="" 0"="" border=" & chr(34) & " chr(34)="" height="16" i-line.gif"="" image="" src=" & chr(34)
ttstr1 = ttstr1 & "/>"
end if
if mid(ttlstr,i,1)="0" then
ttstr1 = ttstr1 & "<img "="" &="" 0"="" border=" & chr(34) & " chr(34)="" height="16" image="" none.gif"="" src=" & chr(34)
ttstr1 = ttstr1 & "/>"
end if
next
if tttype=1 then
ttstr1= ttstr1 & "<a "="" "')"="" "','"="" #"="" &="" call="" chr(34)="" href=" & chr(34) & " onclick=" & chr(34) & " onclickdiv('"="" ttid="" ttlf="" ttstr1="ttstr1">"
ttstr1=ttstr1 & "<img "="" &="" 0"="" border=" & chr(34) & " chr(34)="" height="16" id=" & chr(34) & " image="" l-"="" src=" & chr(34)
if ttlf=0 then
ttstr1= ttstr1 & " t-plus.gif"="" ttid=""/></a>"
else
ttstr1= ttstr1 & "image/l-plus.gif" & chr(34) & " id=" & chr(34) & "l-" & ttid & chr(34) & "
height=16>"
end if
ttstr1= ttstr1 & "<a "="" "')"="" "','"="" #"="" &="" call="" chr(34)="" href=" & chr(34) & " onclick=" & chr(34) & " onclickdiv('"="" ttid="" ttlf="" ttstr1="ttstr1">"
ttstr1=ttstr1 & "<img "="" &="" 0"="" border=" & chr(34) & " c-fold.bmp"="" chr(34)="" height="16" id=" & chr(34) & " image="" p-"="" src=" & chr(34)
ttstr1= ttstr1 & " ttid=""/></a>"
ttstr1= ttstr1 & "<a "="" "')"="" "','"="" #"="" &="" call="" chr(34)="" href=" & chr(34) & " onclick=" &chr(34) & " onclickdiv('"="" ttid="" ttlf="" ttstr1="ttstr1">"
ttstr1=ttstr1 & ttname & "</a><br/>" & vbcrlf
ttstr1=ttstr1 & "<div id=" & chr(34) & ttid & chr(34) & " style="display:none">" & vbcrlf
else
ttstr1 = ttstr1 & "<img "="" &="" 0"="" border=" & chr(34) & " chr(34)="" height="16" image="" src=" & chr(34)
if ttlf=0 then
ttstr1 = ttstr1 & " t-line.gif"=""/>"
else
ttstr1 = ttstr1 & "image/l-line.gif" & chr(34) & " height=16>"
end if
ttstr1= ttstr1 & "<a "="" "','3')"="" #"="" &="" call="" chr(34)="" href=" & chr(34) & " onclick=" & chr(34) & " onclickdiv('"="" ttid="" ttstr1="ttstr1">"
ttstr1=ttstr1 & "<img "="" &="" 0"="" border=" & chr(34) & " chr(34)="" height="16" id=" & chr(34) & " image="" leaf.bmp="" p-"="" src=" & chr(34)
ttstr1= ttstr1 & " ttid=""/></a>"
ttstr1= ttstr1 & "<a "="" "','3')"="" #"="" &="" call="" chr(34)="" href=" & chr(34) & " onclick=" & chr(34) & " onclickdiv('"="" ttid="" ttstr1="ttstr1">"
ttstr1=ttstr1 & ttname & "</a><br/>" & vbcrlf
ttstr1=ttstr1 & "<div id=" & chr(34) & ttid & chr(34) & " style="display:none"></div>" & vbcrlf
end if
end if
getimgstr=ttstr1
end function
Function ShowNode(node,mylvl,myleaf,mylstr)
dim ttstr
dim mystr
dim ttleaf
dim ttn
ttn=0
if myleaf=0 then
ttleaf=0
else
ttleaf=1
end if
For Each child In node.childNodes
ttn=ttn+1
If (child.nodeType=1) Then
nod_name=child.Attributes.getnamedItem("name").Text
nod_type=child.Attributes.getnamedItem("type").Text
nod_id=child.Attributes.getnamedItem("id").Text
if nod_type<>"zs" then
If (child.hasChildNodes) Then
if ttn=node.childnodes.length then
mystr=mystr & getimgstr(nod_id,nod_name,mylvl,1,1,mylstr & "0")
ttstr=ShowNode(child,mylvl+1,1,mylstr & "0")
else
mystr=mystr & getimgstr(nod_id,nod_name,mylvl,1,0,mylstr & "1")
ttstr=ShowNode(child,mylvl+1,0,mylstr & "1")
end if
mystr=mystr & ttstr
mystr=mystr & "</div>"
else
if ttn=node.childnodes.length then
mystr=mystr & getimgstr(nod_id,nod_name,mylvl,0,1,mylstr & "0")
else
mystr=mystr & getimgstr(nod_id,nod_name,mylvl,0,0,mylstr & "1")
end if
End If
else
if ttn=node.childnodes.length then
mystr=mystr & getimgstr(nod_id,nod_name,mylvl,0,1,mylstr & "0")
else
mystr=mystr & getimgstr(nod_id,nod_name,mylvl,0,0,mylstr & "1")
end if
end if
end if
Next
ShowNode=mystr
End Function
dim xmldoc
dim xmlstr
Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")
xmldoc.async=false
xmldoc.load(Server.MapPath("knowledge.xml"))
xmlstr=ShowNode(xmldoc,0,0,"")
' set xmldoc=nothing
'parent.results.display(source.transformNode(style));
1<html>
2<head>
3</head>
4<body>
5<script language="VBScript">
6
7dim olditem
8
9sub OnClickDiv(DivId,pType)
10if (document.all(DivId).style.display="none") then
11document.all(DivId).style.display=""
12if (pType="0") then
13document.all("l-"+DivId).src="image/t-minus.gif"
14document.all("p-"+DivId).src="image/o-fold.bmp"
15end if
16if (pType="1") then
17document.all("l-"+DivId).src="image/l-minus.gif"
18document.all("p-"+DivId).src="image/o-fold.bmp"
19end if
20'if (pType="3") then
21' document.all("p-"+DivId).src="image/o-fold.bmp"
22'end if
23else
24document.all(DivId).style.display="none"
25if (pType="0") then
26document.all("l-"+DivId).src="image/t-plus.gif"
27document.all("p-"+DivId).src="image/c-fold.bmp"
28end if
29if (pType="1") then
30document.all("l-"+DivId).src="image/l-plus.gif"
31document.all("p-"+DivId).src="image/c-fold.bmp"
32end if
33'if (pType="3") then
34' document.all("p-"+DivId).src="image/c-fold.bmp"
35'end if
36end if
37end sub
38</script>
39<font name="宋体" size="2">
40<nobr>```
41=xmlstr
42```</nobr></font>
43</body></html></div>