</body>
<script language= "VbScript" >
'**************************************
' * * * Author: Super Big Stupid wolf superdullwolf****
'**************************************
Public Dic,favour,anything, Doc
Set doc = CreateObject ("Microsoft.XMLDOM")
Doc.async=false
Sub Analyse ()
Dim mytr
favour = Select1.value
Removediv
If not doc.load (File1.value) Then
Alert "The file failed to load, please check if the file exists!" "
Else
Set RootNode = doc. DocumentElement
Set rootdiv = Document.createelement ("DIV")
Rootdiv.setattribute "XPath", Rootnode.nodename
Olist.setattribute "XPath", Rootnode.nodename
Olist.setattribute "parsed", false
Appenddiv Olist,rootnode
End If
End Sub
Sub Appenddiv (Mydiv,mynode)
Dim mychild, Newdiv,childid,thisid, Childxpath
For each mychild in Mynode.childnodes
If Mychild.nodename <> "#text" Then
Set newdiv = Document.createelement ("DIV")
Mydiv.appendchild Newdiv
ADDPX newdiv, mydiv,10 ' indent 10 pixels
Newdiv.attachevent "onclick", GetRef ("Attachonclick")
End If
End If
Next
Mydiv.setattribute "parsed", true ' all child elements are marked.
End Sub
Sub Removediv ()
Dim olddiv
For each olddiv in Olist.childnodes
Olddiv.removenode (True)
Next
End Sub
Sub Attachonclick ()
Dim obj, Nodexpath,cdiv
Set Obj=window.event.srcelement
Nodexpath = Obj.getattribute ("XPath")
If InStr (Nodexpath, "#text") >0 Then
Window.event.cancelBubble = True
Exit Sub
End If
If not Obj.getattribute ("parsed") = True Then
Appenddiv obj, Doc.selectsinglenode (Nodexpath)
Else
For each cdiv in Obj.children
If CDIV.style.display = "None" Then
CDIV.style.display = ""
Else
CDIV.style.display = "None"
End If
Next
End If
Window.event.cancelBubble = True
End Sub
function GetText (MYNODE,ODIV)
Dim myattribute
GetText = ""
Select Case Favour
Case "Text"
If not IsNull (Mynode.text) Then
GetText = Mynode.text
Else
GetText = "Empty Text"
End If
Case "NodeName"
GetText = Mynode.nodename
Case "attribute"
If Mynode.nodename <> "#text" Then
For each myattribute in Mynode.attributes
GetText =gettext & Myattribute.name
GetText = getText & "=" & Chr (34)
GetText = getText & Myattribute.value & Chr (+) & ""
Next
GetText = Trim (getText)
End If
Case "XPath"
GetText = Odiv.title
End Select
If trim (getText) = "" Then GetText = "Empty"
End Function
Sub Addpx (Newdiv,olddiv,num)
Dim re,mystring
Set re = new REGEXP
Re. Global = True
Re. pattern = "[^\d]*"
MyString = Re. Replace (OldDIV.style.paddingLeft, "")
If myString = "" Then myString = "0"
MyString = (CInt (myString) + num) & "px"
NewDIV.style.paddingLeft = myString
Set re = Nothing
End Sub
</script>
Xmltool.hta
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.