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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:58:21+00:00 2026-05-29T05:58:21+00:00

My categories.xml file is given below <categories> <root name=Cars -Vehicles id=CV></root> <root name=Personals id=PER></root>

  • 0

My categories.xml file is given below

<categories>
  <root name="Cars -Vehicles" id="CV"></root>
  <root name="Personals" id="PER"></root>
  <root name="Real Estate" id="RE"></root>
  <root name="Property For Rent" id="PFR"></root>
  <root name="Community" id="COM"></root>
</categories>

and My attibutes.xml file is given below

<attributes>

  <attribute value="ethnicity=ethnicity_african_american" name ="American Indian" categoryid="PER"/>
  <attribute value="ethnicity=ethnicity_asian_pacific_islander" name ="Asian - Pacific Islander" categoryid="PER"/>
  <attribute value="ethnicity=ethnicity_caucasian" name ="Caucasian" categoryid="PER"/>


  <attribute value="amenities=amenities_ac" name ="AC" categoryid="RE, PFR"/>
  <attribute value="amenities=amenities_alarm" name ="Alarm" categoryid="RE, PFR"/>

</attributes>

I bound my attributeDropdown on selection of categoriesDropDown. Code is given below

 protected void ddCategories_SelectedIndexChanged(object sender, EventArgs e)
 {
            XmlDataSource xd = new XmlDataSource();
            xd.DataFile = Server.MapPath("Xmls") + "\\attributes.xml";
            xd.XPath = "/attributes/attribute[@categoryid='" + 
                        categoriesDropDown.SelectedValue.ToString() + "']";

            attributeDropdown.DataSource = xd;
            attributeDropdown.DataTextField = "name";
            attributeDropdown.DataValueField = "value";

            attributeDropdown.DataBind();

         // categoriesDropDown.DataTextField = "name";
         // categoriesDropDown.DataValueField = "id";

 }

Now the problem is two attributes named AC and Alarm are in two categories Real Estate and Property For Rent. How can I bind these attributes on selection of these categories ?

Insort what should be my Xpath Expression if attributes are in multiple categories?

  • 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-29T05:58:22+00:00Added an answer on May 29, 2026 at 5:58 am

    Maybe it isn’t good solution, but you can use contains function, e.g.:

    /attributes/attribute[contains(@categoryid, 'category')]
    

    According to your code:

    xd.XPath = string.Format("/attributes/attribute[contains(@categoryid, '{0}')]",
        categoriesDropDown.SelectedValue);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given some sample data.xml file: <?xml version=1.0 encoding=utf-8?> <data> <categories> <category id=google> <name>Google</name> </category>
How can i retrieve categoryname from given xml file using php <categories> <category categoryid=1100
I have an XML file called categories.xml: <?xml version=1.0 encoding=UTF-8?> <categories> <category> <filter>julyfourth</filter> <name>4th
I have the following XML file: <Categories> <Category name=TopDown> <Path>http://localhost:8080/images/TopDown/Divx.png</Path> <Path>http://localhost:8080/images/TopDown/Blu-Ray.png</Path> <Path>http://localhost:8080/images/TopDown/Divx.png</Path> <Path>http://localhost:8080/images/TopDown/Divx.png</Path> <Path>http://localhost:8080/images/TopDown/Divx.png</Path>
I am pulling categories from an xml file. I only have 5 categories but
How could I query an xml file, like the one below, with C# .NET
I have an XML file with property groups and properties. I want to retrieve
I have an xml file like this: <?xml version=1.0 ?> <scketchit> <categories> <category title=MANGA
I have an XML file called categories.xml. Here is a sample of the file:
Me again... I have an XML File that contains different categories which I would

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.