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

  • Home
  • SEARCH
  • 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 9021921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:22:21+00:00 2026-06-16T05:22:21+00:00

Sample XML: <PTC_FareBreakdowns> <PTC_FareBreakdown> <PassengerTypeQuantity Code=ADT Quantity=1 /> <FareBasisCodes> <FareBasisCode>RGOSAVE</FareBasisCode> </FareBasisCodes> <PassengerFare> <BaseFare Amount=4400

  • 0

Sample XML:

<PTC_FareBreakdowns>
  <PTC_FareBreakdown>
    <PassengerTypeQuantity Code="ADT" Quantity="1" />
    <FareBasisCodes>
      <FareBasisCode>RGOSAVE</FareBasisCode>
    </FareBasisCodes>
    <PassengerFare>
      <BaseFare Amount="4400" CurrencyCode="INR" />
      <Taxes>
        <Tax Amount="233" CurrencyCode="INR" TaxCode="OC" TaxGroupCode="SF" TaxGroupName="Taxes &amp;amp; Fees" />
        <Tax Amount="218" CurrencyCode="INR" TaxCode="OC" TaxGroupCode="SF" TaxGroupName="Taxes &amp;amp; Fees" />
        <Tax Amount="3500" CurrencyCode="INR" TaxCode="YQ" TaxGroupCode="SF" TaxGroupName="Taxes &amp;amp; Fees" />
        <Tax Amount="440" CurrencyCode="INR" TaxCode="OC" TaxGroupCode="SF" TaxGroupName="Taxes &amp;amp; Fees" />
        <Tax Amount="173" CurrencyCode="INR" TaxCode="OC" TaxGroupCode="SF" TaxGroupName="Taxes &amp;amp; Fees" />
        <Tax Amount="0" TaxCode="B2BMarkup" />
      </Taxes>
      <TotalFare Amount="8964" CurrencyCode="INR" />
      <Markups>
        <Markup Amount="0.0000" CurrencyCode="INR" Description="0.0  for client - 26472" MarkupCode="DisplayMarkup" Type="M" />
        <Markup Amount="0" CurrencyCode="INR" Description="0.0 % on base fare  for client - " MarkupCode="DisplayMarkup" MarkupType="M" Type="M" />
        <Markup Amount="0" Description="0.0% on fule surcharge  3500.0for client" MarkupCode="DisplayMarkup" MarkupType="M" Type="M" />
      </Markups>
    </PassengerFare>
  </PTC_FareBreakdown>
</PTC_FareBreakdowns>

The LINQ, I have tried so far,

  var Adult = from Main in xd.Descendants(ns + "PTC_FareBreakdown")
              from Sub1 in Main.Elements(ns + "PassengerTypeQuantity")
              where Sub1.Attribute("Code").Value == "ADT"
              from Sub2 in Main.Elements(ns + "PassengerFare").Elements(ns + "Taxes").Elements(ns + "Tax")
              where Sub2.Attribute("TaxCode").Value == "OC"
              select new
              {
                  OC = Sub2.Attributes("Amount").Sum(nd => Int32.Parse(nd.Value)),
              };

It returns the value as 233,218,440 and 173. But It must return the sum of all value [233+218+440+173=1064].

Please let me know if you need more information.

  • 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-06-16T05:22:23+00:00Added an answer on June 16, 2026 at 5:22 am
     var query = xd.Descendants(ns + "PTC_FareBreakdown")
                   .Elements(ns + "PassengerFare")
                   .Elements(ns + "Taxes")
                   .Elements(ns + "Tax")
                   .Where(tax => (string)tax.Attribute("TaxCode") == "OC") 
                   .Sum(tax => (int)tax.Attribute("Amount"));    
    

    Result: 1064

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

Sidebar

Related Questions

This is my sample XML Code: <bestContact> <firstName><![CDATA[12345]]></firstName> <lastName /> </bestContact> I am using:
I have a sample Xml code snippet <modification name=givenName operation=add xmlns=urn:oasis:names:tc:DSML:2:0:core> <value>Changed name</value> </modification>
Sample XML File <SiEventSchedule deleteStart=2012/01/21 00:00:00 deleteEnd=2012/01/21 23:59:59> </SiEventSchedule> Code: var el = doc.Descendants(ns
Sample XML. <person> <name>Joe Dirt</name> <ssn>123-45-6789</ssn> <dob>07/04/1981</dob> </person> Sample Java Class public class Person(){
I have a sample xml file which looks like the one below: <Root> <SubOne>
This is the sample xml document : <bookstore> <book category=COOKING> <title lang=english>Everyday Italian</title> <author>Giada
Please see the sample xml given below. As per a requirement, I need to
I have a bit of xml file named Sample.xml which is shown below <?xml
This question's solution makes hard-coded transformation of a sample XML tree into a flat
I have been provided an XSD and a sample Xml file that contains the

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.