How to Extract URL from XML page using ASP code

Discussion in 'ASP General' started by Billy, Aug 18, 2007.

  1. Billy

    Billy Guest

    Billy, Aug 18, 2007
    #1
    1. Advertising

  2. Billy wrote:
    > Can anyone guide me to a resource for learning how to extract a URL
    > from an XML page using ASP 3.0 code?
    >
    > This link below is an Amazon web services link that produces an XML
    > page. The resulting XML page has another URL embedded within it that I
    > need to extract and use to redirect the site to it's final URL
    > destination.
    >
    > http://webservices.amazon.com/onca/...ty=1&Item.3.ASIN=B000BOLJ64&Item.3.Quantity=1


    set urlnode = xmldoc.selectSingle Node("/CartCreateResponse")
    url=urlnode.getAttribute("xmlns")

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Aug 18, 2007
    #2
    1. Advertising

  3. Billy

    Billy Guest

    On Aug 18, 7:10 am, "Bob Barrows [MVP]" <>
    wrote:
    > Billy wrote:
    > > Can anyone guide me to a resource for learning how to extract a URL
    > > from an XML page using ASP 3.0 code?

    >
    > > This link below is an Amazon web services link that produces an XML
    > > page. The resulting XML page has another URL embedded within it that I
    > > need to extract and use to redirect the site to it's final URL
    > > destination.

    >
    > >http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AW...

    >
    > set urlnode = xmldoc.selectSingle Node("/CartCreateResponse")
    > url=urlnode.getAttribute("xmlns")
    >
    > --
    > Microsoft MVP - ASP/ASP.NET
    > Please reply to the newsgroup. This email account is my spam trap so I
    > don't check it very often. If you must reply off-line, then remove the
    > "NO SPAM"


    I dont understand what this is. Where does my URL go? Where do you
    specify the data you ant to extract in the URL?
    Billy, Aug 19, 2007
    #3
  4. Billy

    Billy Guest

    On Aug 18, 7:10 am, "Bob Barrows [MVP]" <>
    wrote:
    > Billy wrote:
    > > Can anyone guide me to a resource for learning how to extract a URL
    > > from an XML page using ASP 3.0 code?

    >
    > > This link below is an Amazon web services link that produces an XML
    > > page. The resulting XML page has another URL embedded within it that I
    > > need to extract and use to redirect the site to it's final URL
    > > destination.

    >
    > >http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AW...

    >
    > set urlnode = xmldoc.selectSingle Node("/CartCreateResponse")
    > url=urlnode.getAttribute("xmlns")
    >
    > --
    > Microsoft MVP - ASP/ASP.NET
    > Please reply to the newsgroup. This email account is my spam trap so I
    > don't check it very often. If you must reply off-line, then remove the
    > "NO SPAM"


    OK, I read up on the XML DOM and I coded this. However, I get the
    message

    Microsoft VBScript runtime error '800a01a8'
    Object required
    /amazon_cart.asp, line 17


    Line #17 is the url = urlnode.getAttribute("xmlns") coded line as
    shown below......


    <html>

    <head>
    <title>Amazon Cart</title>
    </head>

    <body>

    <%
    Dim objXML
    Set objXML = Server.CreateObject("Msxml2.DOMDocument.3.0")
    objXML.async = False
    objXML.Load("http://webservices.amazon.com/onca/xml?
    Service=AWSECommerceService&AWSAccessKeyId=ACCESSID&Operation=CartCreate&Item.
    1.ASIN=B000E73MO0" &_
    "&Item.1.Quantity=1&Item.2.ASIN=B00005T3E4&Item.
    2.Quantity=1&Item.3.ASIN=B000BOLJ64&Item.3.Quantity=1")

    Set urlnode = objXML.selectSingleNode("/CartCreateResponse")
    url = urlnode.getAttribute("xmlns")
    Response.Write url

    Set objXML = Nothing
    %>

    </body>

    Is this code compatible with the 3.0 ver of DOM? Could it be something
    needed on the hosted server side? I use DiscountASP.net which just
    about covers all technologies.....
    Billy, Aug 19, 2007
    #4
  5. "Billy" <> wrote in message
    news:...
    > On Aug 18, 7:10 am, "Bob Barrows [MVP]" <>
    > wrote:
    > > Billy wrote:
    > > > Can anyone guide me to a resource for learning how to extract a URL
    > > > from an XML page using ASP 3.0 code?

    > >
    > > > This link below is an Amazon web services link that produces an XML
    > > > page. The resulting XML page has another URL embedded within it that I
    > > > need to extract and use to redirect the site to it's final URL
    > > > destination.

    > >
    > >

    >http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AW...
    > >
    > > set urlnode = xmldoc.selectSingle Node("/CartCreateResponse")
    > > url=urlnode.getAttribute("xmlns")
    > >
    > > --
    > > Microsoft MVP - ASP/ASP.NET
    > > Please reply to the newsgroup. This email account is my spam trap so I
    > > don't check it very often. If you must reply off-line, then remove the
    > > "NO SPAM"

    >
    > OK, I read up on the XML DOM and I coded this. However, I get the
    > message
    >
    > Microsoft VBScript runtime error '800a01a8'
    > Object required
    > /amazon_cart.asp, line 17
    >
    >
    > Line #17 is the url = urlnode.getAttribute("xmlns") coded line as
    > shown below......
    >
    >
    > <html>
    >
    > <head>
    > <title>Amazon Cart</title>
    > </head>
    >
    > <body>
    >
    > <%
    > Dim objXML
    > Set objXML = Server.CreateObject("Msxml2.DOMDocument.3.0")
    > objXML.async = False
    > objXML.Load("http://webservices.amazon.com/onca/xml?
    >

    Service=AWSECommerceService&AWSAccessKeyId=ACCESSID&Operation=CartCreate&Ite
    m.
    > 1.ASIN=B000E73MO0" &_
    > "&Item.1.Quantity=1&Item.2.ASIN=B00005T3E4&Item.
    > 2.Quantity=1&Item.3.ASIN=B000BOLJ64&Item.3.Quantity=1")
    >
    > Set urlnode = objXML.selectSingleNode("/CartCreateResponse")
    > url = urlnode.getAttribute("xmlns")
    > Response.Write url
    >
    > Set objXML = Nothing
    > %>
    >
    > </body>
    >
    > Is this code compatible with the 3.0 ver of DOM? Could it be something
    > needed on the hosted server side? I use DiscountASP.net which just
    > about covers all technologies.....
    >


    The error you are getting is due to the urlnode being Nothing. This is in
    turn is due to the XML not containing a CartCreateResponse root node.
    Which is probably because the Load failed. Load returns true if it has
    successfully loaded the content.

    After calling objXML.load you should check objXML.parseError.errorCode is 0.
    If not then there was a problem loading or parsing the document.
    objXML.parseError.reason will specify what went wrong.

    Note before calling load you should use this line of code:-

    objXML.setProperty "ServerHTTPRequest", True

    Try using:-

    Response.Write objXML.parseError.reason

    just to see if things are OK.

    Then try:-

    Response.Content-Type = "text/xml"
    Response.CharSet = "UTF-8"
    objXML.save Response

    to see the actual XML received.

    Once you're happy you getting the expected XML you can change your code to
    start actually using it.


    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Aug 19, 2007
    #5
  6. Billy

    Billy Guest

    On Aug 19, 4:59 am, "Anthony Jones" <> wrote:
    > "Billy" <> wrote in message
    >
    > news:...
    >
    >
    >
    > > On Aug 18, 7:10 am, "Bob Barrows [MVP]" <>
    > > wrote:
    > > > Billy wrote:
    > > > > Can anyone guide me to a resource for learning how to extract a URL
    > > > > from an XML page using ASP 3.0 code?

    >
    > > > > This link below is an Amazon web services link that produces an XML
    > > > > page. The resulting XML page has another URL embedded within it that I
    > > > > need to extract and use to redirect the site to it's final URL
    > > > > destination.

    >
    > >http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AW....

    >
    > > > set urlnode = xmldoc.selectSingle Node("/CartCreateResponse")
    > > > url=urlnode.getAttribute("xmlns")

    >
    > > > --
    > > > Microsoft MVP - ASP/ASP.NET
    > > > Please reply to the newsgroup. This email account is my spam trap so I
    > > > don't check it very often. If you must reply off-line, then remove the
    > > > "NO SPAM"

    >
    > > OK, I read up on the XML DOM and I coded this. However, I get the
    > > message

    >
    > > Microsoft VBScript runtime error '800a01a8'
    > > Object required
    > > /amazon_cart.asp, line 17

    >
    > > Line #17 is the url = urlnode.getAttribute("xmlns") coded line as
    > > shown below......

    >
    > > <html>

    >
    > > <head>
    > > <title>Amazon Cart</title>
    > > </head>

    >
    > > <body>

    >
    > > <%
    > > Dim objXML
    > > Set objXML = Server.CreateObject("Msxml2.DOMDocument.3.0")
    > > objXML.async = False
    > > objXML.Load("http://webservices.amazon.com/onca/xml?

    >
    > Service=AWSECommerceService&AWSAccessKeyId=ACCESSID&Operation=CartCreate&It­e
    > m.
    >
    >
    >
    >
    >
    > > 1.ASIN=B000E73MO0" &_
    > > "&Item.1.Quantity=1&Item.2.ASIN=B00005T3E4&Item.
    > > 2.Quantity=1&Item.3.ASIN=B000BOLJ64&Item.3.Quantity=1")

    >
    > > Set urlnode = objXML.selectSingleNode("/CartCreateResponse")
    > > url = urlnode.getAttribute("xmlns")
    > > Response.Write url

    >
    > > Set objXML = Nothing
    > > %>

    >
    > > </body>

    >
    > > Is this code compatible with the 3.0 ver of DOM? Could it be something
    > > needed on the hosted server side? I use DiscountASP.net which just
    > > about covers all technologies.....

    >
    > The error you are getting is due to the urlnode being Nothing. This is in
    > turn is due to the XML not containing a CartCreateResponse root node.
    > Which is probably because the Load failed. Load returns true if it has
    > successfully loaded the content.
    >
    > After calling objXML.load you should check objXML.parseError.errorCode is0.
    > If not then there was a problem loading or parsing the document.
    > objXML.parseError.reason will specify what went wrong.
    >
    > Note before calling load you should use this line of code:-
    >
    > objXML.setProperty "ServerHTTPRequest", True
    >
    > Try using:-
    >
    > Response.Write objXML.parseError.reason
    >
    > just to see if things are OK.
    >
    > Then try:-
    >
    > Response.Content-Type = "text/xml"
    > Response.CharSet = "UTF-8"
    > objXML.save Response
    >
    > to see the actual XML received.
    >
    > Once you're happy you getting the expected XML you can change your code to
    > start actually using it.
    >
    > --
    > Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
    >
    > - Show quoted text -- Hide quoted text -
    >
    > - Show quoted text -


    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>
    Billy, Aug 19, 2007
    #6
  7. "Billy" <> wrote in message
    news:...
    On Aug 19, 4:59 am, "Anthony Jones" <> wrote:
    > "Billy" <> wrote in message
    >
    > news:...
    >
    >
    >>>>>>>>>>>>>

    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?


    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Aug 19, 2007
    #7
  8. Billy

    Billy Guest

    On Aug 19, 5:56 pm, "Anthony Jones" <> wrote:
    > "Billy" <> wrote in message
    >
    > news:...
    > On Aug 19, 4:59 am, "Anthony Jones" <> wrote:> "Billy" <> wrote in message
    >
    > >news:...

    >
    > 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?
    >
    > --
    > Anthony Jones - MVP ASP/ASP.NET


    Anthony,

    Thank you. I will try your code and recommended reading and post the
    results.

    For OL2003 ( I suspect similar options in OE)......

    Play with these options.....

    Tools/Prefences/EMail Options
    See sections "On Replies and Forwards"
    When Replying to a Message: Include and Indent Orginal Message Text
    When Fowarding a Message: Include and Indent Orginal Message Text
    Billy, Aug 20, 2007
    #8
  9. "Billy" <> wrote in message
    news:...
    > On Aug 19, 5:56 pm, "Anthony Jones" <> wrote:
    > > "Billy" <> wrote in message
    > >
    > > 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?
    > >
    > > --
    > > Anthony Jones - MVP ASP/ASP.NET

    >
    > Anthony,
    >
    > Thank you. I will try your code and recommended reading and post the
    > results.
    >
    > For OL2003 ( I suspect similar options in OE)......
    >
    > Play with these options.....
    >
    > Tools/Prefences/EMail Options
    > See sections "On Replies and Forwards"
    > When Replying to a Message: Include and Indent Orginal Message Text
    > When Fowarding a Message: Include and Indent Orginal Message Text
    >


    Yes I've got those settings already it's just that with some messages it
    just fails to kick in. Wierd.

    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Aug 20, 2007
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon paugh
    Replies:
    1
    Views:
    686
  2. Ken Varn
    Replies:
    2
    Views:
    613
    Ken Varn
    Jun 22, 2005
  3. Harry Zoroc
    Replies:
    1
    Views:
    920
    Gregory Vaughan
    Jul 12, 2004
  4. =?Utf-8?B?QXhlbCBEYWhtZW4=?=

    Malformed URL by using Page.Request.Url.ToString() - why?

    =?Utf-8?B?QXhlbCBEYWhtZW4=?=, Apr 17, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    876
    Walter Wang [MSFT]
    Apr 18, 2007
  5. Just D.
    Replies:
    0
    Views:
    404
    Just D.
    Aug 11, 2004
Loading...

Share This Page