| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 376 人关注过本帖
标题:看看这段程序吧
只看楼主 加入收藏
bonwezhou
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-4-11
收藏
 问题点数:0 回复次数:0 
看看这段程序吧

Dim w As String
Dim q As String
Dim s As Integer
Public Sub TravelNode(ByRef Nodes As MSXML.IXMLDOMNodeList, ByVal Indent As Integer)
Dim xNode As MSXML.IXMLDOMNode
Indent = Indent + 2
For Each xNode In Nodes
If xNode.nodeType = NODE_TEXT Then
Dim j As String
j = xNode.parentNode.nodeName
If w = j Then
If Trim(xNode.nodeValue) = "*" Then
q = ""
Else: q = xNode.nodeValue
End If
End If
Exit Sub
ElseIf xNode.hasChildNodes Then
TravelNode xNode.childNodes, Indent

End If

Next xNode
End Sub

Private Sub Command1_Click()
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
CommonDialog1.Flags = cdlOFNHideReadOnly
CommonDialog1.Filter = "DTD文件是: (*.dtd)|*.dtd|Text Files" & "(*.txt)|*.txt|Batch Files (*.bat)|*.bat"
CommonDialog1.FilterIndex = 2
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
Exit Sub
ErrHandler:
Exit Sub
End Sub

Private Sub Command2_Click()
Dim str1 As String
Dim a As String
FileName = CommonDialog1.FileName


Open FileName For Input As #1
Open "C:\Documents and Settings\advstu\桌面\bysj.txt" For Output As #2
MsgBox "提交DTD文件完成,请稍候!"
Do While Not EOF(1)
Line Input #1, str1
'If InStr(str1, "<!ELENMENT >") = 0 Then
Print #2, str1
Else
b = Len(str1)
pos = InStr(str1, "<!ELENMENT >")
a = Mid(str1, pos + 2, b - pos - 3)
w = a
Call LoadDocument
Print #2, q

End If
Loop

Close #1
Close #2

inputdialog.Show 1


Exit Sub
End Sub
Public Sub LoadDocument()
Dim xDoc As MSXML.DOMDocument
Set xDoc = New MSXML.DOMDocument
xDoc.validateOnParse = False
If xDoc.Load("Text1.Text") Then
TravelNode xDoc.childNodes, 0
Else
MsgBox ("引导文档出错!")

End If
End Sub


Private Sub Command3_Click()
End
End Sub

2006-05-17 13:38
快速回复:看看这段程序吧
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.085594 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved