|
Newsletters
|
|
|
|
|
Content Management and Distribution Using XML
Output as [simple]HTML
Getting the XML from the document is pretty straightforward XML stuff. Outputting is when the tricky part comes in because there are four ways we can output the HTML:
- Full HTML Summary -- A summary page with just the title and a short summary for each article
- Full HTML Article -- A page with the requested article in its entirety
- Simple HTML Summary -- Same a full except scaled down HTML (no font tags, to tables, etc.)
- Simple HTML Article -- Same as full article scaled down
After we've parsed the XML with our ParseXML function, we use the outHTML function to shoot the data back out to the browser (formatted dynamically) via ASP's Response.Write.
Here's the complete outHTML function, we'll go through it in a second:
outHTML function
Private Sub outHTML(bSummary, bSimple)
' *****************************************
' this subroutine outputs the HTML (or simple HTML, If bSimple = True)
' For the summary (bSummary = True) or main article
' *****************************************
Dim sHeading ' HEADING
Dim sLink ' LINK
Dim sSummary ' SUMMARY
' Write HTML Headers
Response.Write "Wireless Developer Network News - " _
& sDate & "" & vbCrLf
If not bSimple Then
%><%
Response.Write fontize("Wireless Developer Network News", _
"Verdana, Arial, Helvetica", 3)
Else
Response.Write " " & vbCrLf
End If
Response.Write "
" & sDate & " "
' Loop through Articles
Dim i ' generic counter
For i = 1 to UBound(arArticles)
' Set variables
sHeading = arArticles(i).Heading
sLink = arArticles(i).Link
sSummary = arArticles(i).Summary
If bSummary Then
sHeading = "" & sHeading & ""
sBody = sSummary
Else
sBody = "
For p = 1 to UBound(arArticles(i).Paras)
sBody = sBody & arArticles(i).Paras(p) & "
" & vbCrLf
Next ' p
End If
'fontize (put appropriate tags around) text If not simple
If not bSimple Then
sHeading = fontize(sHeading, "Verdana, Arial, Helvetica", 2)
sBody = fontize(sBody, "Verdana, Arial, Helvetica", 2)
sDate = fontize(sDate, "Verdana,Arial, Helvetica", 2)
End If
If (qsLink = "") or (qsLink = sLink) Then
Response.Write " " & sHeading & "
" & sBody _
& " " & vbCrLf
If qsLink = sLink Then Exit For
End If
Next ' i
' Write HTML Footers
If Not bSimple Then
%><%
Else
Response.Write " | |