data_xml = "<Documento>" & data_xml & "</Documento>"
Dim memory_stream As New MemoryStream
Dim writer As New XmlTextWriter(memory_stream, System.Text.Encoding.UTF8)
doc.LoadXml(data_xml)
writer.Formatting = Formatting.Indented
doc.WriteContentTo(writer)
writer.Flush()
memory_stream.Flush()
memory_stream.Position = 0
Dim stream_reader As New StreamReader(memory_stream)
Dim xml_indent As String = stream_reader.ReadToEnd
Dim xml_indent As String = indentar_xml("<Documento>" & data_xml & "</Documento>")
Public Function indentar_xml(ByVal xml_string As String) As String
Dim memory_stream As New MemoryStream
Dim writer As New XmlTextWriter(memory_stream, System.Text.Encoding.UTF8)
Dim doc_xml As New XmlDocument
doc_xml.LoadXml(xml_string)
writer.Formatting = Formatting.Indented
doc_xml.WriteContentTo(writer)
writer.Flush()
memory_stream.Flush()
memory_stream.Position = 0
Dim stream_reader As New StreamReader(memory_stream)
Dim xml_indent As String = stream_reader.ReadToEnd
Return xml_indent
End Function
fuente
No hay comentarios.:
Publicar un comentario