In this code im using InnerText to view only the text from the xml file without any tags. But i want two things to change now:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string xmlString = @"d:\adilipman1937067724.xml";
XmlDocument doc = new XmlDocument();
doc.Load(xmlString);
string t = doc.InnerText;
textBox1.Text = t;
}
}
}
To parse the text to lines.
To parse and add to each line the date and time.
Here is an example of the xml file i want to parse from:
FriendlyName="adilipman@yahoo.com"/></To><Text Style="font-family:Segoe UI; color:#000000; ">testing the test.</Text></Message><Message Date="31/01/2012" Time="10:15:58" DateTime="2012-01-31T08:15:58.897Z" SessionID="1"><From><User FriendlyName="Chocolade"/></From><To><User
Instead to put in a string only the text "testing the test" i want it to be format in the textBox1 like:
adilipman 10:15:58 31/01/2012 testing the test
This is a line. Next line will be for example:
adilipman 10:15:59 31/01/2012 testing the test was ok
But now what im getting in the textBox1 is like this:
testing the test testing the test was ok
Some more text from the xml file:
<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl' href='MessageLog.xsl'?>
<Log FirstSessionID="1" LastSessionID="2"><Message Date="31/01/2012" Time="10:15:42" DateTime="2012-01-31T08:15:42.467Z" SessionID="1"><From><User FriendlyName="Chocolade"/></From><To><User FriendlyName="adilipman@yahoo.com"/></To><Text Style="font-family:Segoe UI; color:#000000; ">היי</Text></Message><Message Date="31/01/2012" Time="10:15:55" DateTime="2012-01-31T08:15:55.097Z" SessionID="1"><From><User FriendlyName="Chocolade"/></From><To><User FriendlyName="adilipman@yahoo.com"/></To><Text Style="font-family:Segoe UI; color:#000000; ">הייתה לי בעיה עם התוכנת ברקים אבל עכשיו הכל עובד.</Text></Message><Message Date="31/01/2012" Time="10:15:58" DateTime="2012-01-31T08:15:58.897Z" SessionID="1"><From><User FriendlyName="Chocolade"/></From><To><User FriendlyName="adilipman@yahoo.com"/></To><Text Style="font-family:Segoe UI; color:#000000; ">מה השלב הבא ?</Text></Message><Message Date="31/01/2012" Time="10:16:27" DateTime="2012-01-31T08:16:27.775Z" SessionID="1"><From><User FriendlyName="Chocolade"/></From><To><User FriendlyName="adilipman@yahoo.com"/></To><Text Style="font-family:Segoe UI; color:#000000; ">אמרת לי בזמנו לחשב ממוצע של 1000 ערכים ? הכוונה 1000 ערכים בפריים ? כי בפריים יש 256 מספרים לא ?</Text></Message><Message Date="31/01/2012" Time="10:17:03" DateTime="2012-01-31T08:17:03.405Z" SessionID="1"><From><User FriendlyName="adilipman@yahoo.com"/></From><To><User FriendlyName="Chocolade"/></To><Text Style="font-family:Segoe UI; color:#000000; ">לחשב ממוצע של 1000 הערכים הגבוהים ביותר בהיסטוגרמה</Text></Message><Message Date="31/01/2012" Time="10:17:10" DateTime="2012-01-31T08:17:10.405Z" SessionID="1"><From><User FriendlyName="adilipman@yahoo.com"/></From><To><User FriendlyName="Chocolade"/></To><Text Style="font-family:Segoe UI; color:#000000; ">ז"א בפריים</Text></Message><Message Date="31/01/2012" Time="10:17:14" DateTime="2012-01-31T08:17:14.135Z" SessionID="1"><From><User FriendlyName="adilipman@yahoo.com"/></From><To><User FriendlyName="Chocolade"/></To><Text Style="font-family:Segoe UI; color:#000000; ">לא בהיסטוגרמה</Text></Message><Message Date="31/01/2012" Time="10:17:20" DateTime="2012-01-31T08:17:20.142Z" SessionID="1"><From><User