S
shapper
Hello,
For the past hours I have been trying to solve a problem which is
driving me crazy.
I have to different codes where the problem to solve is the same:
CODE 1 (Transforms a XML document using a XSL file):
Function Trans()
Dim doc As XmlDocument = New XmlDocument
doc.Load("doc.xml")
Dim docXsl As XslCompiledTransform = New XslCompiledTransform
docXsl.Load("doc.xsl")
docXsl.Transform(doc, Nothing,
HttpContext.Current.Response.Output)
End Function
CODE 2 (Creates XML)
Function Create()
Dim doc As XmlTextWriter = New
XmlTextWriter(Response.OutputStream, Encoding.UTF8)
...
doc.WriteStartElement("item")
doc.WriteElementString("title", "My Title")
doc.WriteEndElement()
...
doc.Flush()
doc.Close()
End Function
I don't want to display the XML files. I don't want to save the XML
files.
I want to return the XML created from each function.
Then outside of each function I want to display the XML in the browser.
Yes, I read about stream or using a string.
But I was not able to make this work.
Could someone please help me out?
Please, give me a code example.
Thank You Very Much,
Miguel
For the past hours I have been trying to solve a problem which is
driving me crazy.
I have to different codes where the problem to solve is the same:
CODE 1 (Transforms a XML document using a XSL file):
Function Trans()
Dim doc As XmlDocument = New XmlDocument
doc.Load("doc.xml")
Dim docXsl As XslCompiledTransform = New XslCompiledTransform
docXsl.Load("doc.xsl")
docXsl.Transform(doc, Nothing,
HttpContext.Current.Response.Output)
End Function
CODE 2 (Creates XML)
Function Create()
Dim doc As XmlTextWriter = New
XmlTextWriter(Response.OutputStream, Encoding.UTF8)
...
doc.WriteStartElement("item")
doc.WriteElementString("title", "My Title")
doc.WriteEndElement()
...
doc.Flush()
doc.Close()
End Function
I don't want to display the XML files. I don't want to save the XML
files.
I want to return the XML created from each function.
Then outside of each function I want to display the XML in the browser.
Yes, I read about stream or using a string.
But I was not able to make this work.
Could someone please help me out?
Please, give me a code example.
Thank You Very Much,
Miguel