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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:02:45+00:00 2026-06-14T00:02:45+00:00

I have the following xml document (I have cleared out the irrelevant data): <?xml

  • 0

I have the following xml document (I have cleared out the irrelevant data):

<?xml version="1.0"?>
<NewOrderNotification xmlns="http://payments.amazon.com/checkout/2008-11-30/">
  <ProcessedOrder>
    <ShippingServiceLevel>blah</ShippingServiceLevel>
    <ProcessedOrderItems>
      <ProcessedOrderItem>
        <AmazonOrderItemCode>blah</AmazonOrderItemCode>
        <Price>
          <Amount>0.2</Amount>
          <CurrencyCode>GBP</CurrencyCode>
        </Price>
        <ItemCharges>
          <Component>
            <Type>Principal</Type>
            <Charge>
              <Amount>0.2</Amount>
              <CurrencyCode>GBP</CurrencyCode>
            </Charge>
          </Component>
          <Component>
            <Type>Shipping</Type>
            <Charge>
              <Amount>0.95</Amount>
              <CurrencyCode>GBP</CurrencyCode>
            </Charge>
          </Component>
          <Component>
            <Type>PrincipalPromo</Type>
            <Charge>
              <Amount>0.0</Amount>
              <CurrencyCode>GBP</CurrencyCode>
            </Charge>
          </Component>
          <Component>
            <Type>ShippingPromo</Type>
            <Charge>
              <Amount>0.0</Amount>
              <CurrencyCode>GBP</CurrencyCode>
            </Charge>
          </Component>
        </ItemCharges>
        <ShippingCustomData>null</ShippingCustomData>
      </ProcessedOrderItem>
    </ProcessedOrderItems>
  </ProcessedOrder>
</NewOrderNotification>

I want to know the xpath syntax for getting each of the values within the 5 different <Amount> elements:

Namely how do I extract each of the following:

  • NewOrderNotification – ProcessedOrder – ProcessedOrderItems – ProcessedOrderItem – Price – Amount

  • NewOrderNotification – ProcessedOrder – ProcessedOrderItems – ProcessedOrderItem – ItemCharges – Component(with type=Principle) – Charge – Amount

  • NewOrderNotification – ProcessedOrder – ProcessedOrderItems – ProcessedOrderItem – ItemCharges – Component(with type=Shipping) – Charge – Amount

  • NewOrderNotification – ProcessedOrder – ProcessedOrderItems – ProcessedOrderItem – ItemCharges – Component(with type=PrincipalPromo) – Charge – Amount

  • NewOrderNotification – ProcessedOrder – ProcessedOrderItems – ProcessedOrderItem – ItemCharges – Component(with type=ShippingPromo) – Charge – Amount

Please note the xmlns in the root element.

This is the JScript code I’m using to extract elements:

var xmlDoc = Server.CreateObject("Msxml2.DOMDocument.6.0");
xmlDoc.setProperty("SelectionNamespaces", "xmlns:a='http://payments.amazon.com/checkout/2008-11-30/'");
xmlDoc.loadXML(xml);
var node = xmlDoc.documentElement.selectSingleNode("XPATH_IN_HERE");
return node.text;
  • 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-14T00:02:46+00:00Added an answer on June 14, 2026 at 12:02 am

    The first amount you can get with just:

    //Price/Amount/text()
    #=> "0.2"
    

    For the other four, you can use the text of the preceding sibling Type element to get their values:

    //Charge[preceding-sibling::Type="Principal"]/Amount/text()
    #=> "0.2"
    
    //Charge[preceding-sibling::Type="Shipping"]/Amount/text()
    #=> "0.95"
    
    //Charge[preceding-sibling::Type="PrincipalPromo"]/Amount/text()
    #=> "0.0"
    
    //Charge[preceding-sibling::Type="ShippingPromo"]/Amount/text()
    #=> "0.0"
    

    I think that does it. (Let me know if I misunderstood your question.)

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

Sidebar

Related Questions

I have the following xml: <GetPurchaseContractResponse xmlns=http://payments.amazon.com/checkout/v2/2010-08-31/> <GetPurchaseContractResult> <PurchaseContract> <Id>amzn1.contract.1.1.1.d6779be6bf481167fe945</Id> <State>ACTIVE</State> <MerchantId>XXXXXXXXXX</MerchantId> <ExpirationTimeStamp>2012-07-19T10:55:28.134Z</ExpirationTimeStamp> <MarketplaceId>A1SDFERWERSDF</MarketplaceId>
I have the following XML Document: <?xml version=\1.0\ encoding=\UTF-8\?> <atom:entry xmlns:atom=\http://www.w3.org/2005/Atom\ xmlns:apps=\http://schemas.google.com/apps/2006\ xmlns:gd=\http://schemas.google.com/g/2005\> <apps:property
I have the following XML document <?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005' xmlns:issues='http://schemas.google.com/projecthosting/issues/2009' gd:etag='W/DEAERH47eCl7ImA9WhZTFEQ.'><id>http://code.google.com/feeds/issues/p/chromium/issues/full/921</id><published>2008-09-03T22:51:22.000Z</published><updated>2011-03-19T01:05:05.000Z</updated><title>Incorrect rendering</title><content
I have the following XML document: <places xmlns=http://where.yahooapis.com/v1/schema.rng xmlns:yahoo=http://www.yahooapis.com/v1/base.rng yahoo:start=0 yahoo:count=1 yahoo:total=1> <place yahoo:uri=http://where.yahooapis.com/v1/place/23424975
I have the following XML: <?xml version=1.0 encoding=UTF-8 standalone=yes?> <application xmlns=http://research.sun.com/wadl/2006/10> <doc xmlns:jersey=http://jersey.dev.java.net/ jersey:generatedBy=Jersey:
I have the following XML document: <application xmlns=http://www.example.com/schemas/app-config/1.0 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.example.com/schemas/app-config/1.0 http://www.example.com/schemas/app-config/1.0/app-config-1.0.xsd> <info name=Dummy Application
I have the following XML document: <tt xmlns=http://www.w3.org/ns/ttml xmlns:tts=http://www.w3.org/ns/ttml#styling xml:lang=en> <head></head> <body> <div xml:lang=it>
I have the following xml document: <?xml version=1.0 encoding=UTF-8?> <root> <data> <child1>&#160;Well, some spaces
Lets say I have the following XML file: <?xml version=1.0 encoding=utf-8?> <Customers xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=Customer.xsd>
I have the following simple XML document: <?xml version=1.0 encoding=UTF-8?> <cars> <car> <data attrib=Make>

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.