'<?xml version='1.0' encoding='GB2312'?>
'<ntsc>
'
<time>
' <year>2010</year>
'
<month>10</month>
' <day>31</day>
'
<Weekday></Weekday>
'
<hour>11</hour>
'
<minite>29</minite>
'
<second>35</second>
'
<Millisecond></Millisecond>
'
</time>
'</ntsc>
Public Function GetXmlValue(ByVal sKey As String, ByVal sSrc As String) As
String
Dim regEx As RegExp ' 需要引用 Microsof VBScript Regular
Expressions 5.5
Dim m As Match ' 是一个对象,
Dim ms As MatchCollection
' 是一个数组 property: count, item
Dim sms As SubMatches ' 是一个数组
Dim v
As Object
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = "<" & sKey & ">(.*)</" & sKey & ">"
' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分字符大小写。
regEx.Global =
False ' 设置只返回第一个匹配的结果,因为也就只有一个。
Set ms = regEx.Execute(sSrc) '
执行搜索。
GetXmlValue = ms(0).SubMatches(0)
End Function