MobileViews Commentaries Archive - Powered by HanDBase
<%
'010617 - Todd Ogasawara
'011222 - Converted from client-side Javascript to ASP
'Source code Copyright 2001 Todd Ogasawara
Dim DoubleQuotes
DoubleQuotes = chr(34)
Function writeBR()
Response.Write " "
End Function
Function writeItalics(textString)
Response.Write ""
Response.Write textString
Response.Write ""
End Function
Function writeBold(textString)
Response.Write ""
Response.Write textString
Response.Write ""
End Function
Function writeColor(textColor, textString)
Response.Write ""
Response.Write textString
Response.Write ""
End Function
function buildLocalAnchor (anchorName)
Response.Write ""
writeBold anchorName
Response.WRite ""
End Function
function buildURLlink (recWeblink, recURL)
if recURL <> "" then
Response.Write ""
Response.Write ""
if recWeblink <> "" then
Response.Write recWeblink
else
Response.Write recURL
end if
Response.Write ""
else
Response.Write recWeblink
end if
writebr
end function 'buildURLlink()
'Main function
function loadXML()
Const nWebLinks = 3 ' Max number of web links in commentary
Dim xmlDoc, objRootElement, numRecords, i
Dim sRecord, recDate, recTitle, recCommentary, recCommentary2
Dim recArrayWebLink(3)
Dim recArrayWebURL(3)
Dim recImage1, recImage1Caption
' Instantiate the XML Processor
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
' Have the processor validate the document
xmlDoc.validateOnParse=True
' Load the XML document
xmlDoc.load(Server.MapPath("Commentary.XML"))
' Set the document element
Set objRootElement = xmlDoc.documentElement
' Force the file to load synchronously (all at once)
xmlDoc.async = false
Response.Write ""
Response.Write "Number of Commentaries = "
Response.Write objRootElement.childnodes.length
Response.Write ""
Response.Write ""
For i = 0 to objRootElement.childNodes.length - 1
recDate = objRootElement.childNodes(i).firstChild.text
recTitle = objRootElement.childNodes(i).childNodes(1).text
recCommentary = objRootElement.childNodes(i).childNodes(2).text
recCommentary2 = objRootElement.childNodes(i).childNodes(3).text
' dump the weblinks text & URLs into the arrays
For j=0 to nWebLinks-1
recArrayWebLink(j) = objRootElement.childNodes(i).childNodes(4+j*2).text
recArrayWebURL(j) = objRootElement.childNodes(i).childNodes(4+j*2+1).text
Next ' For j
' get image & caption (if any)
recImage1 = objRootElement.childNodes(i).childNodes(10).text
recImage1Caption = objRootElement.childNodes(i).lastChild.text
if recImage1 <> "" then 'display image
Response.Write "
"
Response.Write ""
end if
if recImage1Caption <> "" then 'display caption for image
writeBR
Response.Write ""
writeBold recImage1Caption
Response.Write ""
Response.Write "
"
end if
if recDate <> "" then 'display commentary info
writeBold recDate
Response.Write " "
end if
if recTitle <> "" then 'display title
buildLocalAnchor recTitle '& also build an Anchor reference
Response.Write ": "
end if
if recCommentary <> "" then 'display Commentary part 1
Response.Write recCommentary
end if
'2nd commentary field in case commentary overflows 2K char max of 1st field
if recCommentary2 <> "" then
Response.Write recCommentary2
end if
Response.Write "
"
' build web links at bottom of commentary
for j = 0 to nWebLinks-1
if recArrayWebLink(j) <> "" then
buildURLlink recArrayWebLink(j), recArrayWebURL(j)
end if
next 'j
Response.Write "
"
Next 'i loop
' destroy the COM object when finished
Set xmlDoc = nothing
end function 'loadXML()
%>