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 3431714
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:21:38+00:00 2026-05-18T07:21:38+00:00

everyone! I couldn’t find a tutorial explaining the right way to code this. I

  • 0

everyone! I couldn’t find a tutorial explaining the right way to code this. I think it will be clear from the title and the code what I’m trying to do. The two errors I’m receiving is that my if statement is in the wrong place, and that the variable ‘Arrow’ is assigned but never used. I know this comes down to simple syntax, so I thank everyone for their time.

void DATABASEinfo_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
    {
        if (e.Error != null)
            return;

        XElement xmlitem = XElement.Parse(e.Result);

        var list = new List<DATABASEinfoViewModel>();            


        foreach (XElement item in xmlitem.Element("channel").Elements("item"))
        {
            var title = item.Element("title");
            var titlevalue = (title == null) ? null : title.Value;
            var description = item.Element("description");
            var descriptionvalue = (description == null) ? null : description.Value;                
            var arrow = (xmlitem.Element("title").Value.Contains("DATABASE Up"))
                ? "up" : null;


            list.Add(new DATABASEinfoViewModel
            {
                Title = titlevalue,
                Description = descriptionvalue,
                Arrow = arrow,                   
            });
        }                       

        DATABASEinfoList.ItemsSource = list;           
    }          

    public class DATABASEinfoViewModel
    {
        public string Title { get; set; }
        public string Description { get; set; }
        public string Arrow { get; set; } 

Oddly, if I change:

var arrow = (xmlitem.Element("title").Value.Contains("DATABASE Up"))

To:

var arrow = (xmlitem.Element("channel").Value.Contains("DATABASE Up"))

It displays “up” for ALL entries. Here is an example of the XML file:

<rss version="2.0">
<channel>
<title> DATABASE Status</title>
<description>DATABASE status updates</description>      

<item>
<title>First status is DATABASE Up</title>
<description>First Content</description>
</item>

<item>
<title>Second status is DATABASE Up</title>
<description>Second Content</description>
</item>

</channel>
  • 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-05-18T07:21:38+00:00Added an answer on May 18, 2026 at 7:21 am

    The line

    var arrow = (xmlitem.Element("title").Value.Contains("DATABASE Up")) 
    

    should actually be

    var arrow = (item.Element("title").Value.Contains("DATABASE Up")) 
    

    You should be querying item, not xmlitem.

    As mentioned in other answers, you should also be checking that elements exist before accessing their values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Everyone uses source-code control to manage versions (right?) and this provides some level of
Hey, everyone. I couldn't find anything Googling this problem, and I've found really good
Everyone remembers google browser sync right? I thought it was great. Unfortunately Google decided
Everyone has this huge massively parallelized supercomputer on their desktop in the form of
Everyone is familiar with this functionality. If you open up the the outlook address
I couldn't find any reference on how to use a parent form element in
Hey everyone, this seems like it should be a simple one; I really hope
First of all, sorry about the title -- I couldn't figure out one that
Everyone I work with is obsessed with the data-centric approach to enterprise development and
Everyone has accidentally forgotten the WHERE clause on a DELETE query and blasted some

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.