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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:16:44+00:00 2026-06-05T17:16:44+00:00

I am trying to select three values from xml document. I want to get

  • 0

I am trying to select three values from xml document.
I want to get the value from within the node. There are five values in the xml file and I want to know what will be the best approach to take them.
Please find the xml file below.
Thanks in advance, Laziel

  <?xml version="1.0" encoding="UTF-8"?>
<RatingServiceSelectionResponse>
   <Response>
      <TransactionReference>
         <CustomerContext>Bare Bones Rate Request</CustomerContext>
         <XpciVersion>1.0001</XpciVersion>
      </TransactionReference>
      <ResponseStatusCode>1</ResponseStatusCode>
      <ResponseStatusDescription>Success</ResponseStatusDescription>
   </Response>
   <RatedShipment>
      <Service>
         <Code>03</Code>
      </Service>
      <RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
      <BillingWeight>
         <UnitOfMeasurement>
            <Code>LBS</Code>
         </UnitOfMeasurement>
         <Weight>34.0</Weight>
      </BillingWeight>
      <TransportationCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>32.44</MonetaryValue>
      </TransportationCharges>
      <ServiceOptionsCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>0.00</MonetaryValue>
      </ServiceOptionsCharges>
      <TotalCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>32.44</MonetaryValue>
      </TotalCharges>
      <GuaranteedDaysToDelivery />
      <ScheduledDeliveryTime />
      <RatedPackage>
         <TransportationCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>32.44</MonetaryValue>
         </TransportationCharges>
         <ServiceOptionsCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>0.00</MonetaryValue>
         </ServiceOptionsCharges>
         <TotalCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>32.44</MonetaryValue>
         </TotalCharges>
         <Weight>13.0</Weight>
         <BillingWeight>
            <UnitOfMeasurement>
               <Code>LBS</Code>
            </UnitOfMeasurement>
            <Weight>34.0</Weight>
         </BillingWeight>
      </RatedPackage>
      <NegotiatedRates>
         <NetSummaryCharges>
            <GrandTotal>
               <CurrencyCode>USD</CurrencyCode>
               <MonetaryValue>24.52</MonetaryValue>
            </GrandTotal>
         </NetSummaryCharges>
      </NegotiatedRates>
   </RatedShipment>
   <RatedShipment>
      <Service>
         <Code>12</Code>
      </Service>
      <RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
      <BillingWeight>
         <UnitOfMeasurement>
            <Code>LBS</Code>
         </UnitOfMeasurement>
         <Weight>34.0</Weight>
      </BillingWeight>
      <TransportationCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>93.32</MonetaryValue>
      </TransportationCharges>
      <ServiceOptionsCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>0.00</MonetaryValue>
      </ServiceOptionsCharges>
      <TotalCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>93.32</MonetaryValue>
      </TotalCharges>
      <GuaranteedDaysToDelivery>3</GuaranteedDaysToDelivery>
      <ScheduledDeliveryTime />
      <RatedPackage>
         <TransportationCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>93.32</MonetaryValue>
         </TransportationCharges>
         <ServiceOptionsCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>0.00</MonetaryValue>
         </ServiceOptionsCharges>
         <TotalCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>93.32</MonetaryValue>
         </TotalCharges>
         <Weight>13.0</Weight>
         <BillingWeight>
            <UnitOfMeasurement>
               <Code>LBS</Code>
            </UnitOfMeasurement>
            <Weight>34.0</Weight>
         </BillingWeight>
      </RatedPackage>
      <NegotiatedRates>
         <NetSummaryCharges>
            <GrandTotal>
               <CurrencyCode>USD</CurrencyCode>
               <MonetaryValue>69.95</MonetaryValue>
            </GrandTotal>
         </NetSummaryCharges>
      </NegotiatedRates>
   </RatedShipment>
   <RatedShipment>
      <Service>
         <Code>02</Code>
      </Service>
      <RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
      <BillingWeight>
         <UnitOfMeasurement>
            <Code>LBS</Code>
         </UnitOfMeasurement>
         <Weight>34.0</Weight>
      </BillingWeight>
      <TransportationCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>148.56</MonetaryValue>
      </TransportationCharges>
      <ServiceOptionsCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>0.00</MonetaryValue>
      </ServiceOptionsCharges>
      <TotalCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>148.56</MonetaryValue>
      </TotalCharges>
      <GuaranteedDaysToDelivery>2</GuaranteedDaysToDelivery>
      <ScheduledDeliveryTime />
      <RatedPackage>
         <TransportationCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>148.56</MonetaryValue>
         </TransportationCharges>
         <ServiceOptionsCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>0.00</MonetaryValue>
         </ServiceOptionsCharges>
         <TotalCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>148.56</MonetaryValue>
         </TotalCharges>
         <Weight>13.0</Weight>
         <BillingWeight>
            <UnitOfMeasurement>
               <Code>LBS</Code>
            </UnitOfMeasurement>
            <Weight>34.0</Weight>
         </BillingWeight>
      </RatedPackage>
      <NegotiatedRates>
         <NetSummaryCharges>
            <GrandTotal>
               <CurrencyCode>USD</CurrencyCode>
               <MonetaryValue>99.21</MonetaryValue>
            </GrandTotal>
         </NetSummaryCharges>
      </NegotiatedRates>
   </RatedShipment>
   <RatedShipment>
      <Service>
         <Code>13</Code>
      </Service>
      <RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
      <BillingWeight>
         <UnitOfMeasurement>
            <Code>LBS</Code>
         </UnitOfMeasurement>
         <Weight>34.0</Weight>
      </BillingWeight>
      <TransportationCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>204.04</MonetaryValue>
      </TransportationCharges>
      <ServiceOptionsCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>0.00</MonetaryValue>
      </ServiceOptionsCharges>
      <TotalCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>204.04</MonetaryValue>
      </TotalCharges>
      <GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
      <ScheduledDeliveryTime />
      <RatedPackage>
         <TransportationCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>204.04</MonetaryValue>
         </TransportationCharges>
         <ServiceOptionsCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>0.00</MonetaryValue>
         </ServiceOptionsCharges>
         <TotalCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>204.04</MonetaryValue>
         </TotalCharges>
         <Weight>13.0</Weight>
         <BillingWeight>
            <UnitOfMeasurement>
               <Code>LBS</Code>
            </UnitOfMeasurement>
            <Weight>34.0</Weight>
         </BillingWeight>
      </RatedPackage>
      <NegotiatedRates>
         <NetSummaryCharges>
            <GrandTotal>
               <CurrencyCode>USD</CurrencyCode>
               <MonetaryValue>129.82</MonetaryValue>
            </GrandTotal>
         </NetSummaryCharges>
      </NegotiatedRates>
   </RatedShipment>
   <RatedShipment>
      <Service>
         <Code>14</Code>
      </Service>
      <RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
      <BillingWeight>
         <UnitOfMeasurement>
            <Code>LBS</Code>
         </UnitOfMeasurement>
         <Weight>34.0</Weight>
      </BillingWeight>
      <TransportationCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>248.35</MonetaryValue>
      </TransportationCharges>
      <ServiceOptionsCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>0.00</MonetaryValue>
      </ServiceOptionsCharges>
      <TotalCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>248.35</MonetaryValue>
      </TotalCharges>
      <GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
      <ScheduledDeliveryTime>8:00 A.M.</ScheduledDeliveryTime>
      <RatedPackage>
         <TransportationCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>248.35</MonetaryValue>
         </TransportationCharges>
         <ServiceOptionsCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>0.00</MonetaryValue>
         </ServiceOptionsCharges>
         <TotalCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>248.35</MonetaryValue>
         </TotalCharges>
         <Weight>13.0</Weight>
         <BillingWeight>
            <UnitOfMeasurement>
               <Code>LBS</Code>
            </UnitOfMeasurement>
            <Weight>34.0</Weight>
         </BillingWeight>
      </RatedPackage>
      <NegotiatedRates>
         <NetSummaryCharges>
            <GrandTotal>
               <CurrencyCode>USD</CurrencyCode>
               <MonetaryValue>248.35</MonetaryValue>
            </GrandTotal>
         </NetSummaryCharges>
      </NegotiatedRates>
   </RatedShipment>
   <RatedShipment>
      <Service>
         <Code>01</Code>
      </Service>
      <RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning>
      <BillingWeight>
         <UnitOfMeasurement>
            <Code>LBS</Code>
         </UnitOfMeasurement>
         <Weight>34.0</Weight>
      </BillingWeight>
      <TransportationCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>212.86</MonetaryValue>
      </TransportationCharges>
      <ServiceOptionsCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>0.00</MonetaryValue>
      </ServiceOptionsCharges>
      <TotalCharges>
         <CurrencyCode>USD</CurrencyCode>
         <MonetaryValue>212.86</MonetaryValue>
      </TotalCharges>
      <GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
      <ScheduledDeliveryTime>10:30 A.M.</ScheduledDeliveryTime>
      <RatedPackage>
         <TransportationCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>212.86</MonetaryValue>
         </TransportationCharges>
         <ServiceOptionsCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>0.00</MonetaryValue>
         </ServiceOptionsCharges>
         <TotalCharges>
            <CurrencyCode>USD</CurrencyCode>
            <MonetaryValue>212.86</MonetaryValue>
         </TotalCharges>
         <Weight>13.0</Weight>
         <BillingWeight>
            <UnitOfMeasurement>
               <Code>LBS</Code>
            </UnitOfMeasurement>
            <Weight>34.0</Weight>
         </BillingWeight>
      </RatedPackage>
      <NegotiatedRates>
         <NetSummaryCharges>
            <GrandTotal>
               <CurrencyCode>USD</CurrencyCode>
               <MonetaryValue>135.38</MonetaryValue>
            </GrandTotal>
         </NetSummaryCharges>
      </NegotiatedRates>
   </RatedShipment>
</RatingServiceSelectionResponse>

EDIT: I need to get the MonetaryValue from within the NegotiatedRates element.
Sorry about that. Thanks

  • 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-05T17:16:45+00:00Added an answer on June 5, 2026 at 5:16 pm

    Use LINQtoXML to handle this

    string filePath = Server.MapPath(@"../YourFileLocation/somexml.xml");
    
    //you can load the XML from file/stream /string etc...
    
    XElement elem = XElement.Load(filePath);
    if (elem != null)
    {
        var items = elem.Descendants("NegotiatedRates").ToList();
        foreach (var singleItem in items)
        {
            var mo = singleItem.Descendants("MonetaryValue").SingleOrDefault();
            string monetaryValue = mo.Value;
        }
    }
    

    As per the XML you provided, You will get 6 items in the items variable and inside your foreach, you will get the value of MonetaryValue element into the string variable monetaryValue

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

Sidebar

Related Questions

I am trying to select specific values from a xml document using XPath. The
I'm trying to get a collection of values from an XML document: <root> <string
I am trying to extract values from an XML file using linq to create
Well, I was trying to select rows from one table if there are no
I'm trying to return rows in Open XML form from a table value function
I am trying to read a xml file from the web and parse it
I am trying to pass items from a mysql database into an xml file
I am trying to get data from one row in a table into three
I'm trying to insert some data from a XML document into a variable table.
I'm trying to select the max date in three different fields in each record

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.