Trying to write in XML

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
public: void printXML()<br/>

<span style="white-space:pre {<br/>
<span style="white-space:pre array<RichTextBox^> ^ textboxes = gcnew array<RichTextBox^> { richTextBox1, richTextBox2, richTextBox3, richTextBox4, richTextBox5, richTextBox6, richTextBox7, richTextBox8, richTextBox9, richTextBox10, richTextBox11,
richTextBox12};<br/>
<span style="white-space:pre SaveFileDialog^ saveFile1 = gcnew SaveFileDialog;<br/>
<span style="white-space:pre saveFile1->DefaultExt = "*.rtf";<br/>
<span style="white-space:pre saveFile1->Filter = "RTF Files|*.rtf";<br/>
<span style="white-space:pre if ( saveFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK && saveFile1->FileName->Length > 0 )<br/>
<span style="white-space:pre {<br/>
<span style="white-space:pre for each( auto textbox in textboxes )<br/>
<span style="white-space:pre {<br/>
<span style="white-space:pre //File::AppendAllText(saveFile1->FileName, textbox->Text );<br/>
<span style="white-space:pre WriteStartDocument(saveFile1->FileName);<br/>
<span style="white-space:pre WriteStartElement("Name");<br/>
<span style="white-space:pre WriteString(textbox->Text);<br/>
<span style="white-space:pre WriteEndElement();<br/>
<span style="white-space:pre File::AppendAllText(saveFile1->FileName, Environment::NewLine);<br/>
<span style="white-space:pre }<br/>
<span style="white-space:pre }<br/>
<span style="white-space:pre }

I am trying to make my object output in xml format. I initiate the object textbox but that holds my string data to be inserted. Do I have to create a second object or is the a cleaner way like File:: is to File::AppendAllText to call on the class declarations?

textboxObject -> convert to XML -> write to file -> write newline -> loop

View the full article
 
Back
Top