-
how to display xml file
I am new to vb.net and to using xml. I have been able to use an xml/xsl. I have created the xmldoc and applied a style sheet to it. . This is the last line where the transform has happened to my document.
xslTran.Transform(xmlDoc, Nothing, writer, Nothing)
How do I display this on the window?
-
Write the contents of the XmlDoc out... either using console.writeline or a multiline textbox...
-
Write to a window
How does it get written to the window? Does console mean the window?
-
I don't know buddy.... you have to tell me what you want to write to...
1) Console window for a Console Application
or
2) A multi-line textbox in a Windows Forms Application (if you have a Form object in your project, you want this one)
after you do the transform, use an XmlReader to spit out the XML to the textbox...
-
Getting there
On some days it feels like I am standing still... but I am learning...
I finally have all of my code working, and am able to display the transformed xslt in HTML form in the text window. Just don't have my data in it yet. I thought the transform would take the loaded xslt and merge it with the xmldoc. My code looks like this:
Dim ds As New DataSet("Assessment")
Dim sqladp As New SqlClient.SqlDataAdapter("SELECT idAssessment, strDemPatLstNm, StrDemPatFstNm,IntDemPatAge FROM tblDemographics WHERE idAssessment='" & m_subject.Assessment() & "'", objRefs.Conn)
sqladp.Fill(ds, "Assessment")
' Loading Data Set into xmlDoc
Dim xmlDoc As Xml.XmlDataDocument = New Xml.XmlDataDocument(ds)
'1 Creating a obj to use to transform
Dim xslTran As Xml.Xsl.XslTransform = New Xml.Xsl.XslTransform
'Load style sheet into xslTran sheet sits in bin directory
xslTran.Load("Quick_View.xslt")
'Create file to hold Transformed data
Dim writer2 As Xml.XmlTextWriter = New Xml.XmlTextWriter(Application.LocalUserAppDataPath & "xslt_output.html", System.Text.Encoding.UTF8)
---------------------------------------------------
' Load file with xml data from xmldoc
xslTran.Transform(xmlDoc, Nothing, writer2, Nothing)
----------------------------------------------------
writer2.Close()
Me.AxWebBrowser1.Navigate(Application.LocalUserAppDataPath & "xslt_output.html")
Any any ideas?