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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:30:29+00:00 2026-05-16T07:30:29+00:00

I am using VS 2008. I have to create a wcf service and inside

  • 0

I am using VS 2008. I have to create a wcf service and inside the service i have to do some basic operations on a xml file using LINQ to XML. I have to host the service in IIS 7.0 and consume it.

As part of the LINQ to XML I have to do the following tasks :

  1. find all the questions in all the Enquiry that answers are no
  2. modify the question and answer of Enquiry id=”Enquiry2″

Pasted below is the XML file

<b:ServeySet xmlns:b="b:urn:schemas-microsoft-com">
  <b:Enquires>
    <b:Enquiry id="Enquiry1">
      <b:Question id="1" question="is the summer hot in LA?" answer="yes"/>
      <b:Question id="3" question="is this hard exercise?" answer="no"/>
      <b:Question id="2" question="is this awesome?" answer="yes"/>
    </b:Enquiry >
    <b:Enquiry id="Enquiry2">
      <b:Question id="1" question="what is SFO?" answer="City"/>
      <b:Question id="2" question="is this hard exercise?" answer="no"/>
    </b:Enquiry >
  </b:Enquires>
</b:ServeySet>
  • 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-16T07:30:30+00:00Added an answer on May 16, 2026 at 7:30 am

    Try something like this:

    static void Main(string[] args)
    {
        // create the XDocument and load the file from disk
        XDocument doc = XDocument.Load("youroriginalfile.xml");
    
        // define the XML namespace used
        XNamespace b = "b:urn:schemas-microsoft-com:billing-data";
    
        // get all the questions where the answer is "no"
        var questionsWithAnswerNo = doc.Descendants(b + "Question").Where(x => x.Attribute("answer").Value == "no");
    
        // loop over these questions and do something.....
        foreach (XElement question in questionsWithAnswerNo)
        {
            // do something
        }
    
        // find questions for test with "test2" id
        var test2 = doc.Descendants(b + "Test").Where(x => x.Attribute("id").Value == "test2").FirstOrDefault();
    
        if(test2 != null)
        {
            // loop over questions, prepend a "TEST2: " to both question and
            // answer attribute of each of the questions
            foreach (XElement q2 in test2.Descendants(b + "Question"))
            {
                a2.Attribute("question").Value = "Test2: " + a2.Attribute("question").Value;
                a2.Attribute("answer").Value = "Test2: " + a2.Attribute("answer").Value;
            }
    
            // save the modified file
            doc.Save("newfile.xml");
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service running on Windows 2008 R2 64 bit, using IIS
I have tried to create a hello world Web Service using visual studio 2008,
I have created a WCF webservice using WCF Service Application template in VS 2008.
I'm trying to access list data using SSRS 2008. I have created an XML
I am using T/SQL in Microsoft SQL Server 2008 I have a table CREATE
I'm using Microsoft SQL Svr Mgmt Studio 2008. I don't have access to create
I have created a reference to an IIS hosted WCF service in my ASP.NET
I'm using VB 2008 express to create a windows form application. I have a
I'm using Visual Studio 2008 and have created a setup project for my application.
I have created a web application using Visualstudio 2008 using C# on my computer.

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.