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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:31:43+00:00 2026-05-25T15:31:43+00:00

I have an xml document like this… this xml doc provides content for webpages

  • 0

I have an xml document like this… this xml doc provides content for webpages

<pages id="pages">
  <page id="Shipping-Services">
    <linktext>Shipping Services</linktext>
    <pagelink>Shipping-Services</pagelink>
     <content>Shipping Services</content>
     <H1>Shipping Services</H1>
     <LogoALT>Shipping Services</LogoALT>
     <Title>Shipping Services</Title>
     <Desc>Shipping Services</Desc>
     <KeyWords>My, Key, Words</KeyWords>
     <banner></banner>
     <market>value</market>
   </page>
</pages>

I am trying to search based on page id and market using xmldocument.selectnodes

XmlDocument xdoc2 = new XmlDocument();
xdoc2.Load(Server.MapPath("~/xml/Pagesextend.xml"));
XmlNodeList xList2 = xdoc2.SelectNodes(".//*[@id='" + Request.QueryString[1].ToString() + "']");

tried this…. not working

 XmlDocument xdoc = new XmlDocument();
 xdoc.Load(Server.MapPath("~/xml/Pages.xml"));
 XmlNodeList xList = xdoc.SelectNodes(".//*[@id='" + Request.QueryString["p"].ToString() + "' and contains(market, '" + Request.QueryString["m"].ToString() + "']");

I can search by ID no problem, but adding the second market parameter is stumping me… Any assistance would be great.

what xpath would I enter to use two parameters how I have the xml setup?

  • 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-25T15:31:44+00:00Added an answer on May 25, 2026 at 3:31 pm

    You missed the closing ‘)’ on the contains.

    XmlDocument xdoc = new XmlDocument();
    xdoc.Load(Server.MapPath("~/xml/Pages.xml"));
    XmlNodeList xList = xdoc.SelectNodes(".//*[@id='" + Request.QueryString["p"].ToString() + "' and contains(market, '" + Request.QueryString["m"].ToString() + "')]");
    

    I usually prefer to use string.Format() for XPath:

    XmlNodeList xList = xmlDoc.SelectNodes(string.Format(".//*[@id='{0}' and contains(market, '{1}')]", Request.QueryString["p"].ToString(), Request.QueryString["m"].ToString()));
    

    Helps a bit when you need to look for minor syntax errors like missing parenthesis.

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

Sidebar

Related Questions

I have an XML document with some sample content like this: <someTag> <![CDATA[Hello World]]>
I have an xml document that looks like this. <?xml version=1.0?> <services> <service sn=1
I have a xml document like this : <Node1 attrib1=abc> <node1_1> <node1_1_1 attrib2 =
Hi I have an xml document like this <root> <cert id=1> </cert> <cert id=2>
I have an xml document that looks like this. <foo> <bar type=artist/> Bob Marley
Say I have a xml document that looks like this <foo> <bar id=9 />
I have an XML document which looks something like this: <meadinkent> <record> <comp_div>MENSWEAR</comp_div> <sty_ret_type>ACCESSORIES</sty_ret_type>
I have got an XML document which looks something like this. <Root> <Info>....</Info> <Info>....</Info>
I am writing an XML document in C#. I have something like this... string
I have an xml document like this: <?xml version=1.0 encoding=utf-8 ?> <demographics> <country id=1

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.