Kai77
asked on
Show data of MemoryStream in a literal control
I am using the XMLtextwriter to create XML data. The writer writes the data into a memorystream. Once it is finished I would like to show the XML data in a literal control, before I use an XSL file for a transformation.
My code:
Dim oMemoryStream As New System.IO.MemoryStream
Dim oXMLWriter As System.Xml.XmlTextWriter
oXMLWriter = New System.Xml.XmlTextWriter(o MemoryStre am, System.Text.Encoding.UTF8)
With oXMLWriter
.Formatting = System.Xml.Formatting.Inde nted
.Indentation = 4
.IndentChar = CChar(" ")
.WriteStartDocument()
.WriteStartElement("naviga tion")
Call WriteNavigationItems(oXMLW riter, PageInfo.AtaChapterID)
.WriteEndElement()
.WriteEndDocument()
End With
oXMLWriter.Flush()
oMemoryStream.Position = 0
Dim XMLdoc As New XPathDocument(oMemoryStrea m)
oMemoryStream.Close()
Dim stylesheet As New XslTransform
stylesheet.Load("E:\BA - Projects\Bright Alley\wwwroot\FE\ba_contro ls\default \navigatio n.xslt")
Dim oStringWriter As New System.IO.StringWriter
stylesheet.Transform(XMLdo c.CreateNa vigator(), Nothing, oStringWriter, Nothing)
ltlNavigation.Text = oStringWriter.ToString
oXMLWriter.Close()
My code:
Dim oMemoryStream As New System.IO.MemoryStream
Dim oXMLWriter As System.Xml.XmlTextWriter
oXMLWriter = New System.Xml.XmlTextWriter(o
With oXMLWriter
.Formatting = System.Xml.Formatting.Inde
.Indentation = 4
.IndentChar = CChar(" ")
.WriteStartDocument()
.WriteStartElement("naviga
Call WriteNavigationItems(oXMLW
.WriteEndElement()
.WriteEndDocument()
End With
oXMLWriter.Flush()
oMemoryStream.Position = 0
Dim XMLdoc As New XPathDocument(oMemoryStrea
oMemoryStream.Close()
Dim stylesheet As New XslTransform
stylesheet.Load("E:\BA - Projects\Bright Alley\wwwroot\FE\ba_contro
Dim oStringWriter As New System.IO.StringWriter
stylesheet.Transform(XMLdo
ltlNavigation.Text = oStringWriter.ToString
oXMLWriter.Close()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok thanks man
All instances of classes are objects. Thus, there is no need to use the prefix o.
HTH