Hi all,
I am using VS2003. I am new to VS2003. I cannot transform an xml file into a string output in my windows application. But the same function works well with VS2005. it also asks for xmlresolver in the transform() function. I provided Nothing as 4th parameter, eventhough it doesnt work. anybody can help me?. I dont know where i am wrong. I need to create html files with this xml data.
[CODE="VB"]
Public Shared Function CreateHtmlFile( ByVal ds As DataSet, ByVal xslpath As String) As String
Dim document As XmlDocument ' Xml document root
Dim navigator As XPathNavigator ' navigate document
Dim transformer As XslTransform ' transform document
Dim output As StringWriter
document = New XmlDocument()
document.LoadXm l(ds.GetXml())
' create navigator
navigator = document.Create Navigator
' load style sheet
transformer = New XslTransform()
transformer.Loa d(xslpath)
' transform XML data
output = New StringWriter()
transformer.Tra nsform(navigato r, Nothing, output)
' display transformation in text box
Console.WriteLi ne(output.ToStr ing)
' write transformation result to disk
Dim stream As FileStream = _
New FileStream("c:\ Billcustomer1.h tml", FileMode.Create )
Dim writer As StreamWriter = New StreamWriter(st ream)
writer.Write(ou tput.ToString)
' close streams
writer.Close()
output.Close()
Return output.ToString ()
End Function
[/code]
With thanks,
Sudha
I am using VS2003. I am new to VS2003. I cannot transform an xml file into a string output in my windows application. But the same function works well with VS2005. it also asks for xmlresolver in the transform() function. I provided Nothing as 4th parameter, eventhough it doesnt work. anybody can help me?. I dont know where i am wrong. I need to create html files with this xml data.
[CODE="VB"]
Public Shared Function CreateHtmlFile( ByVal ds As DataSet, ByVal xslpath As String) As String
Dim document As XmlDocument ' Xml document root
Dim navigator As XPathNavigator ' navigate document
Dim transformer As XslTransform ' transform document
Dim output As StringWriter
document = New XmlDocument()
document.LoadXm l(ds.GetXml())
' create navigator
navigator = document.Create Navigator
' load style sheet
transformer = New XslTransform()
transformer.Loa d(xslpath)
' transform XML data
output = New StringWriter()
transformer.Tra nsform(navigato r, Nothing, output)
' display transformation in text box
Console.WriteLi ne(output.ToStr ing)
' write transformation result to disk
Dim stream As FileStream = _
New FileStream("c:\ Billcustomer1.h tml", FileMode.Create )
Dim writer As StreamWriter = New StreamWriter(st ream)
writer.Write(ou tput.ToString)
' close streams
writer.Close()
output.Close()
Return output.ToString ()
End Function
[/code]
With thanks,
Sudha
Comment