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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:48:55+00:00 2026-05-18T10:48:55+00:00

I have a very simple xml string that I loaded using XmlDocument class. Now

  • 0

I have a very simple xml string that I loaded using XmlDocument class. Now I am trying to read it via XPath query and I get this error,

“Expression must evaluate to a node-set.”

Here is my Xml,

<RF_SearchTermBanners>
   <ImageName>3pc-leather-set.jpg</ImageName>
</RF_SearchTermBanners>

Here is my C# code,

protected void BindSearchBanner(string ImageUrl)
{
    //Parse Xml string containing Image name
    System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
    xmlDoc.LoadXml(ImageUrl);

    System.Xml.XmlNode node = (System.Xml.XmlNode)xmlDoc.DocumentElement;
    System.Xml.XmlElement imageElem = node.SelectSingleNode("@/RF_SearchTermBanners/ImageName") as System.Xml.XmlElement;

    string imgUrl = imageElem.InnerText;

    if (imgUrl != null && imgUrl != string.Empty)
    {
        SearchBanner.ImageUrl = "~/Themes/Default/Images" + imgUrl;
        SearchBanner.Visible = true;
    }
    else
    {
        SearchBanner.ImageUrl = string.Empty;
        SearchBanner.Visible = false;
    }
}

Please help.

  • 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-18T10:48:55+00:00Added an answer on May 18, 2026 at 10:48 am

    Did you mean @"/RF_SearchTermBanners/ImageName"? In XPath, an @ symbol represents an attribute.

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

Sidebar

Related Questions

I have a very simple XML: <Rows> <Row> <id>1</id> <name>foo</name> <more>xyz</more> </Row> <Row> <id>2</id>
I have very simple situation and really don't have a clue why this isn't
Im trying to do a very simple thing (showing a populated listView) but im
I'm looking to build a library that needs to be very careful about memory
I want to do the following: I want to make a very simple gallery
I have a listview with a dozen of rows binded to xml. I'd like
I'm not the first to have these issues, and will list some reference posts
I'm trying to figure out how to use a preference (the ones you can
Previous I issued a question on how to change Maven project vesion from command
Could someone please help me out with this. I need to find the gml:pos

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.