Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8448639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:28:57+00:00 2026-06-10T10:28:57+00:00

This is the function: private void ParseAndDisplayXml(string filename) { XDocument document = XDocument.Load(filename); var

  • 0

This is the function:

private void ParseAndDisplayXml(string filename)
        {
            XDocument document = XDocument.Load(filename);
            var list = document.Root.Elements("Message")
                .Select(
                e => new
                {
                    Date = e.Attribute("Date").Value.ToString(),
                    Time = e.Attribute("Time").Value.ToString(),
                    Text = e.Element("Text").Value.ToString(),
                    Name = e.Element("FriendlyName").Value.ToString()
                }
                );
 string result="";
            foreach (var item in list)
            {
               result += string.Format("Date--{0},Time--{1},Text--{2},Name--{3}", item.Date, item.Time, item.Text, item.Name + Environment.NewLine);

            }
            textBox1.Text = result;
        }

Im getting null on the Name variable in this part:

                {
                    Date = e.Attribute("Date").Value.ToString(),
                    Time = e.Attribute("Time").Value.ToString(),
                    Text = e.Element("Text").Value.ToString(),
                    Name = e.Element("FriendlyName").Value.ToString()
                }

This is some content 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 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:50" DateTime="2012-01-31T08:17:50.648Z" SessionID="1"><From><Us

What i want to do is that it will show me: adilipman hello
Then: chocolade hi

For now what im getting is a date time and text but i want to add also the name for each line and text so i know who said it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:28:58+00:00Added an answer on June 10, 2026 at 10:28 am

    Isn’t FrindlyName an attribute of element user, which I assume is from the from element and not the to element.

    e.Element("From").Element("User").Attribute("FriendlyName").Value.ToString()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function like this in actionscript3 private function uploadFile(event:MouseEvent):void { var uploader:URLRequest
private function editForm():void { var event:DepManagementEvent = new DepManagementEvent(Edit Page,true); var navi:String; event.navi =
here it is, using this function: private static void write(String Swrite) throws IOException {
I wrote this function private void richAdd(string who, string what) { string colorstring =
I have the following simple function: private void EnableDisable941ScheduleBButton() { if (this._uosDepositorFrequency.Value != null)
So given this input string: =?ISO-8859-1?Q?TEST=2C_This_Is_A_Test_of_Some_Encoding=AE?= And this function: private string DecodeSubject(string input) {
I have a ComboBox with a label function like this one: private function fieldLabelFunction(item:Object):String
I have an array of function callbacks, like this: class Blah { private var
Take this example code private void test() { Label1.Text = Function 1 started.; function1();
the function private void SetUpMasterPage(){ this.MasterPageFile = ~/MasterPages/NestedMasterPageTest2.Master; } is called on the OnPreInit...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.