Rajkumar_G
asked on
using XMLTextWriter convert the xml tags to MemoryStream
I have the following code windows application
Dim ms As MemoryStream
ms = New MemoryStream
Dim xtw As New Xml.XmlTextWriter(ms, System.Text.Encoding.UTF8)
xtw.Formatting = Formatting.Indented
xtw.Indentation = 2
xtw.QuoteChar = """"c
xtw.WriteStartDocument(Tru e)
xtw.WriteComment("Data from CSI")
xtw.WriteStartElement("Dat a")
xtw.WriteStartElement("Emp loyee")
xtw.WriteElementString("La stName", "Dillan")
xtw.WriteElementString("Fi rstName", "Bob")
xtw.WriteElementString("Mi ddleInitia l", "E")
xtw.WriteEndElement()
xtw.WriteEndDocument()
xtw.Close()
I am using XMLTextWriter to fill the MemoryStream. What appears to be
happening is that the memory stream is getting filled. If I step through
this code and look at the length of (ms.length), it is always 0 (zero).
What am I missing? Any and all help is greatly appreciated.
--
Thanks,
Dim ms As MemoryStream
ms = New MemoryStream
Dim xtw As New Xml.XmlTextWriter(ms, System.Text.Encoding.UTF8)
xtw.Formatting = Formatting.Indented
xtw.Indentation = 2
xtw.QuoteChar = """"c
xtw.WriteStartDocument(Tru
xtw.WriteComment("Data from CSI")
xtw.WriteStartElement("Dat
xtw.WriteStartElement("Emp
xtw.WriteElementString("La
xtw.WriteElementString("Fi
xtw.WriteElementString("Mi
xtw.WriteEndElement()
xtw.WriteEndDocument()
xtw.Close()
I am using XMLTextWriter to fill the MemoryStream. What appears to be
happening is that the memory stream is getting filled. If I step through
this code and look at the length of (ms.length), it is always 0 (zero).
What am I missing? Any and all help is greatly appreciated.
--
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
using ms before xtw.close()