Note that there are some explanatory texts on larger screens.

plurals
  1. POConcerned with writing xml
    primarykey
    data
    text
    <p>I have a mail application. While sending to each recipient I am writing to an XML file named mail.xml. I use the following code:</p> <pre><code>Dim from As String = txtFrom.Text Dim txto As String = txtTo.Text Dim subj As String = txtSubject.Text Dim body As String = txtBody.Text Dim settings As New XmlWriterSettings() settings.Indent = True settings.NewLineOnAttributes = True Using writer As XmlWriter = XmlWriter.Create("C:\xmlmailfile.xml", settings) writer.WriteStartDocument() writer.WriteStartElement("EMail") writer.WriteStartElement("From") writer.WriteStartAttribute("From") writer.WriteValue(from) writer.WriteEndAttribute() writer.WriteStartElement("To") writer.WriteStartAttribute("To") writer.WriteValue(txto) writer.WriteEndAttribute() writer.WriteStartElement("Subject") writer.WriteStartAttribute("Subject") writer.WriteValue(subj) writer.WriteEndAttribute() writer.WriteStartElement("Body") writer.WriteStartAttribute("Body") writer.WriteValue(body) writer.WriteEndAttribute() writer.WriteEndElement() writer.WriteEndDocument() writer.Flush() End Using </code></pre> <p>And the output is: </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;EMail&gt; &lt;From From="abc@xyz.com"&gt; &lt;To To="def@pqr.com"&gt; &lt;Subject Subject="Hi"&gt; &lt;Body Body="Hello" /&gt; &lt;/Subject&gt; &lt;/To&gt; &lt;/From&gt; &lt;/EMail&gt; </code></pre> <p>Here I am not able to append to existing output. Only one "Email" section is being output. I want to add an "Email" section for each recipient. However, in the above code new sections replace previously written ones. </p> <p>How can I accomplish this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload