<%
dim i, a, strXMLPath, strXMLExpression
strXMLPath = Server.Mappath("/aspemporium/examples/xmlcatalog/database.xml")
strXMLExpression = "/CATALOG/MOVIE[RUNNINGTIME $gt$ 100]/RATING | " & _
"/CATALOG/MOVIE[RUNNINGTIME $gt$ 100]/TITLE"
a = XMLRead( strXMLPath, strXMLExpression )
for i = 0 to ubound(a) - 1
Response.Write a(i) & "<BR>"
next
%>
<%
Private Function XMLRead(byVal xmlfilepath, byVal expression)
dim temp, item, tmp, objXML, tmpArray
On Error Resume Next
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.Load( xmlfilepath )
If Err Then
On Error GoTo 0
Err.Raise 5140, "XMLRead Function", _
"Specified XML File Not Found."
Err.Clear
XMLRead = Null
set objXML = Nothing
Exit Function
End If
set temp = objXML.documentElement.selectnodes( expression )
If Err Then
On Error GoTo 0
Err.Raise 5140, "XMLRead Function", _
"Expression argument produced an error."
Err.Clear
XMLRead = Null
set objXML = Nothing
Exit Function
End If
for each item in temp
tmp = tmp & item.text & vbCrLf & "/" & vbCrLf
next
set temp = Nothing
set objXML = Nothing
tmpArray = Split( tmp, vbCrLf & "/" & vbCrLf )
XMLRead = tmpArray
On Error GoTo 0
End Function
%>