Is there anyway to output a whole DW page as XML ouput in order to integrate it with flash?
- Sune
Is there anyway to output a whole DW page as XML ouput in order to integrate it with flash?
- Sune
The only way that would not require you to produce any custom code would be to modify Master, Page, Paragraph and potential module templates to product XML rather that HTML.
Hi Sune
I Have this piece of code which will export an entire Area to XML. Modify the Where statement to have it export only one page:
Public Shared Function getAreaContentAsXml(ByVal AreaID As Integer) As Xml.XmlDocument
Dim sql As New Text.StringBuilder
sql.Append("SELECT Area.AreaID, Area.AreaName, Page.PageID, Page.PageMenuText, Page.PageMouseOver, Paragraph.ParagraphID, Paragraph.ParagraphHeader, Paragraph.ParagraphText, Paragraph.ParagraphSort ")
sql.Append("FROM (Area RIGHT JOIN Page ON Area.AreaID = Page.PageAreaID) RIGHT JOIN Paragraph ON Page.PageID = Paragraph.ParagraphPageID ")
sql.Append("WHERE AreaID = " & AreaID & " ")
sql.Append("ORDER BY Area.AreaID, Page.PageID, Paragraph.ParagraphSort ")
Dim XmlDoc As XmlDocument = New XmlDocument
Dim xmlDeclaration As XmlDeclaration = XmlDoc.CreateXmlDeclaration("1.0", "utf-8", String.Empty)
XmlDoc.InsertBefore(xmlDeclaration, XmlDoc.DocumentElement)
Dim RootNode As XmlElement = XmlDoc.CreateElement("Content")
XmlDoc.AppendChild(RootNode)
Dim CurrentAreaID As Integer = 0
Dim AreaNode As XmlElement = Nothing
Dim CurrentPageID As Integer = 0
Dim PageNode As XmlElement = Nothing
'Dim CurrentParagraphID As Integer
Dim dr As IDataReader = Database.getDataReader(sql.ToString)
Do While dr.Read
If CurrentAreaID <> Base.ChkInteger(dr.Item("AreaID")) Then
AreaNode = XmlDoc.CreateElement("Area")
AreaNode.SetAttribute("ID", Base.ChkString(dr.Item("AreaID")))
Dim AreaNameNode As XmlElement = XmlDoc.CreateElement("Name")
AreaNameNode.InnerText = Base.ChkString(dr.Item("AreaName"))
AreaNode.AppendChild(AreaNameNode)
'AreaNode.SetAttribute("Name", Base.ChkString(dr.Item("AreaName")))
CurrentAreaID = Base.ChkInteger(dr.Item("AreaID"))
RootNode.AppendChild(AreaNode)
End If
If CurrentPageID <> Base.ChkInteger(dr.Item("PageID")) Then
PageNode = XmlDoc.CreateElement("Page")
PageNode.SetAttribute("ID", Base.ChkString(dr.Item("PageID")))
Dim MenuTextNode As XmlElement = XmlDoc.CreateElement("MenuText")
MenuTextNode.InnerText = Base.ChkString(dr.Item("PageMenuText"))
PageNode.AppendChild(MenuTextNode)
Dim MouseOverNode As XmlElement = XmlDoc.CreateElement("MouseOver")
MouseOverNode.InnerText = Base.ChkString(dr.Item("PageMouseOver"))
PageNode.AppendChild(MouseOverNode)
'PageNode.SetAttribute("MenuText", Base.ChkString(dr.Item("PageMenuText")))
'PageNode.SetAttribute("MouseOver", Base.ChkString(dr.Item("PageMouseOver")))
CurrentPageID = Base.ChkInteger(dr.Item("PageID"))
AreaNode.AppendChild(PageNode)
End If
Dim ParagraphNode As XmlElement
ParagraphNode = XmlDoc.CreateElement("Paragraph")
ParagraphNode.SetAttribute("ID", Base.ChkString(dr.Item("ParagraphID")))
'ParagraphNode.SetAttribute("Header", Base.ChkString(dr.Item("ParagraphHeader")))
Dim ParagraphHeaderNode As XmlElement = XmlDoc.CreateElement("Header")
ParagraphHeaderNode.InnerText = Base.ChkString(dr.Item("ParagraphHeader"))
ParagraphNode.AppendChild(ParagraphHeaderNode)
Dim ParagraphTextNode As XmlElement = XmlDoc.CreateElement("Text")
If Base.ChkBoolean(Base.Request("Escape")) Then
Dim ParagraphTextNodeData As XmlCDataSection = XmlDoc.CreateCDataSection("")
ParagraphTextNodeData.Data = Base.ChkString(dr.Item("ParagraphText"))
ParagraphTextNode.AppendChild(ParagraphTextNodeData)
Else
Dim xHtml As String = Base.ChkString(dr.Item("ParagraphText"))
Dim rh As SgmlReaderDll.SGMLReaderHelper = New SgmlReaderDll.SGMLReaderHelper
Try
xHtml = rh.ProcessString(xHtml)
Catch ex As Exception
End Try
Try
ParagraphTextNode.InnerXml = xHtml
Catch ex As Exception
ParagraphTextNode.InnerText = Base.ChkString(dr.Item("ParagraphText"))
Dim ErrorNode As XmlElement = XmlDoc.CreateElement("Error")
ErrorNode.InnerText = ex.ToString
ParagraphNode.AppendChild(ErrorNode)
End Try
End If
ParagraphNode.AppendChild(ParagraphTextNode)
PageNode.AppendChild(ParagraphNode)
Loop
dr.Close()
dr.Dispose()
Return XmlDoc
End Function
cool I'll translate it to C# and try it out
- Sune
You must be logged in to post in the forum