I used the objXML.setProperty "ServerHTTPRequest", True right before
the XML load and this worked - I recvd back the contents of the xmlns
tag in my browser. Thank you!
However, I really need to grab the PurchaseURL in tis XML (shown
below) and submit it automatically to the browser. I suspect that I
will use a Response.Redirect to submit the PurchaseURL, but I need to
understand how to get to it first.
I looked on the web for SlectSingleNode syntax and I've had a real
hard time getting good information on it for beginners. I've also read
through XML DOM in W3 Schools, but have yet to find out how the
SelectSingleNode parameters works. I suspect that I'm using the
correct function by using SelectSingleNode (If I'm wrong, please
advise).
I really just need to understand how to navigate through the nodes to
grab what I want. Any examples would be appreciated.
Here is the XML that I load:
<?xml version="1.0" encoding="UTF-8" ?>
- <CartCreateResponse xmlns="
http://webservices.amazon.com/
AWSECommerceService/2005-10-05">
+ <OperationRequest>
- <HTTPHeaders>
<Header Name="UserAgent" Value="Mozilla/4.0 (compatible; MSIE 7.0;
Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.0.3705; .NET CLR
1.1.4322)" />
</HTTPHeaders>
<RequestId>1Y86JP8EYYVME4ZVD8ZG</RequestId>
- <Arguments>
<Argument Name="Item.1.ASIN" Value="B000E73MO0" />
<Argument Name="Service" Value="AWSECommerceService" />
<Argument Name="Item.2.ASIN" Value="B00005T3E4" />
<Argument Name="Item.1.Quantity" Value="1" />
<Argument Name="Item.2.Quantity" Value="1" />
<Argument Name="Operation" Value="CartCreate" />
<Argument Name="Item.3.Quantity" Value="1" />
<Argument Name="Item.3.ASIN" Value="B000BOLJ64" />
<Argument Name="AWSAccessKeyId" Value="ACCESSKeyId" />
</Arguments>
<RequestProcessingTime>0.232803106307983</RequestProcessingTime>
</OperationRequest>
- <Cart>
- <Request>
<IsValid>True</IsValid>
- <CartCreateRequest>
- <Items>
- <Item>
<ASIN>B000E73MO0</ASIN>
<Quantity>1</Quantity>
</Item>
- <Item>
<ASIN>B00005T3E4</ASIN>
<Quantity>1</Quantity>
</Item>
- <Item>
<ASIN>B000BOLJ64</ASIN>
<Quantity>1</Quantity>
</Item>
</Items>
</CartCreateRequest>
</Request>
<CartId>102-8451736</CartId>
<HMAC>8Ii25TILTMsE7n2zl=</HMAC>
<URLEncodedHMAC>8Ii25TILTMsE7n2zln%2BoVMt5Hn0%3D</URLEncodedHMAC>
<PurchaseURL>
https://www.amazon.com/gp/cart/aws-merge.html?cart-
id=102-8451736%26associate-id=Mt5Hn0=
%26SubscriptionId=G2%26MergeCart=False</PurchaseURL>
- <SubTotal>
<Amount>9191</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$91.91</FormattedPrice>
</SubTotal>
- <CartItems>
- <SubTotal>
<Amount>9191</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$91.91</FormattedPrice>
</SubTotal>
- <CartItem>
<CartItemId>U2XH7SPFEHRQLD</CartItemId>
<ASIN>B000E73MO0</ASIN>
<MerchantId>ATVPDKIKX0DER</MerchantId>
<SellerId>A2R2RITDJNW1Q6</SellerId>
<SellerNickname>Amazon.com</SellerNickname>
<Quantity>1</Quantity>
<Title>Mrs. Meyer's Clean Day Counter Top Spray, Lavender, Case of 6
- 16 Ounce Bottles (96 Ounces)</Title>
<ProductGroup>Drugstore</ProductGroup>
- <Price>
<Amount>2754</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$27.54</FormattedPrice>
</Price>
- <ItemTotal>
<Amount>2754</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$27.54</FormattedPrice>
</ItemTotal>
</CartItem>
- <CartItem>
<CartItemId>U1QXVOR3X7NSH0</CartItemId>
<ASIN>B00005T3E4</ASIN>
<MerchantId>ATVPDKIKX0DER</MerchantId>
<SellerId>A2R2RITDJNW1Q6</SellerId>
<SellerNickname>Amazon.com</SellerNickname>
<Quantity>1</Quantity>
<Title>Duracell Ultra AAA Batteries - 8-Pack</Title>
<ProductGroup>Drugstore</ProductGroup>
- <Price>
<Amount>599</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$5.99</FormattedPrice>
</Price>
- <ItemTotal>
<Amount>599</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$5.99</FormattedPrice>
</ItemTotal>
</CartItem>
- <CartItem>
<CartItemId>U2BTS0V2OTNF7J</CartItemId>
<ASIN>B000BOLJ64</ASIN>
<MerchantId>ATVPDKIKX0DER</MerchantId>
<SellerId>A2R2RITDJNW1Q6</SellerId>
<SellerNickname>Amazon.com</SellerNickname>
<Quantity>1</Quantity>
<Title>Tide Free Powder Detergent, Case Pack, Four - 60 Load Boxes
(240 Loads)</Title>
<ProductGroup>Drugstore</ProductGroup>
- <Price>
<Amount>5838</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$58.38</FormattedPrice>
</Price>
- <ItemTotal>
<Amount>5838</Amount>
<CurrencyCode>USD</CurrencyCode>
<FormattedPrice>$58.38</FormattedPrice>
</ItemTotal>
</CartItem>
</CartItems>
</Cart>
</CartCreateResponse>
<<<<<<<<<<<<<<<<<<
elemPurchaseURL =
objXML.selectSingleNode("/CartCreateResponse/Cart/PurchaseURL")
If Not elemPurchaseURL is Nothing Then
Response.Redirect elemPurchaseURL.text
Else
Response.Write "Purchase URL not found"
End If
If you want to understand what selectSingleNode is doing you also need to
read w3schools XPath tutorial. However be aware that they've updated it to
reflect XPath 2.0 but MSXML only supports XPath 1.0. In fact by default
MSXML 3 use XSL pattern as a selection language. Since the query path in
this case is so simple this doesn't matter. However to use other features
of XPath you would need another setProperty call:-
objXML.setProperty "SelectionLanguage", "XPath"
or if you know your ISP has MSXML 6 installed use the .6.0 ProgIDs instead.
BTW, does anybody know why Outlook Express sometimes fails to indent quoted
text?