private void ActGenerate_Click(System.Object sender, System.EventArgs e) { // ----- Generate the XML content using the settings. MemoryStream holdBuffer; Char[] charArray; UTF8Encoding decoder; // ----- Set the XML namespace. SampleDataSet.Tables["Customer"].Namespace = TableNamespace.Text.Trim(); SampleDataSet.Tables["Customer"].Prefix = TablePrefix.Text.Trim(); SampleDataSet.Tables["Order"].Namespace = TableNamespace.Text.Trim(); SampleDataSet.Tables["Order"].Prefix = TablePrefix.Text.Trim(); // ----- Indicate the relationship type. SampleDataSet.Relations[0].Nested = NestChildRecords.Checked; // ----- Clear any existing results. SerializedResults.Clear(); // ----- Build a memory stream to hold the results. holdBuffer = new MemoryStream(8192); SampleDataSet.WriteXml(holdBuffer, (XmlWriteMode)OutputWriteMode.SelectedItem); // ----- Convert it to something displayable. decoder = new UTF8Encoding(); holdBuffer.Seek(0, SeekOrigin.Begin); charArray = new Char[decoder.GetCharCount(holdBuffer.ToArray()) - 1]; decoder.GetDecoder().GetChars(holdBuffer.ToArray(), 0, charArray.Length, charArray, 0); SerializedResults.Text = new string(charArray); }
private void ActGenerate_Click(System.Object sender, System.EventArgs e) { // ----- Generate the XML content using the settings. MemoryStream holdBuffer; Char[] charArray; UTF8Encoding decoder; // ----- Set the XML namespace. // ----- Indicate the relationship type. // ----- Clear any existing results. SerializedResults.Clear(); // ----- Build a memory stream to hold the results. // ----- Convert it to something displayable. decoder = new UTF8Encoding(); holdBuffer.Seek(0, SeekOrigin.Begin); charArray = new Char[decoder.GetCharCount(holdBuffer.ToArray()) - 1]; decoder.GetDecoder().GetChars(holdBuffer.ToArray(), 0, charArray.Length, charArray, 0); SerializedResults.Text = new string(charArray); }