In the following code I want to set “standalone = yes” to the xml, how can I do this?
Dim settings As New Xml.XmlWriterSettings
settings.Encoding = encoding
Using stream As New IO.MemoryStream, xtWriter As Xml.XmlWriter = _
Xml.XmlWriter.Create(stream, settings)
serializer.Serialize(xtWriter, obj)
Return encoding.GetString(stream.ToArray())
End Using
For example, I have this:
<?xml version="1.0" encoding="utf-8"?>
But I want this:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
If you want to do this then you’ll need to use
WriteProcessingInstructionmethod and manually write it out.