HighTechTalks DotNet Forums  

LINQ to XML and Amazon Webservices

Dotnet XML microsoft.public.dotnet.xml


Discuss LINQ to XML and Amazon Webservices in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
mudGil
 
Posts: n/a

Default LINQ to XML and Amazon Webservices - 09-20-2007 , 10:06 AM






Hi, I'm having a hard time in using LINQ on XML returned from Amazon
Webservices.

I'm using the 2008 beta 2 on an XP machine.

the code I'm using is:

=========
Dim s As String
s = "http://ecs.amazonaws.com/onca/xml?" & _
"Service=AWSECommerceService&" & _
"AWSAccessKeyId=1234&" & _
"AssociateTag=my-tag&" & _
"ResponseGroup=Small&" & _
"Operation=ItemSearch&" & _
"SearchIndex=Music&" & _
"Keywords=neil young"
Dim ResponseDoc As Linq.XDocument = XDocument.Load(s)
Dim ReturnedItems = From ReturnedItem In
ResponseDoc.Descendants("Item") _
Select ASIN = ReturnedItem.Element("ASIN").Value, _
URL = ReturnedItem.Element("DetailPageURL").Value

===========

ReturnedItems is always empty.

Am I doing something wrong? Is Amazon XML wrong in some way?

thanks

Gil S.
--
They don''''t make bugs like bunny anymore

Reply With Quote
  #2  
Old   
Martin Honnen
 
Posts: n/a

Default Re: LINQ to XML and Amazon Webservices - 09-20-2007 , 10:35 AM






mudGil wrote:
Quote:
Hi, I'm having a hard time in using LINQ on XML returned from Amazon
Webservices.

I'm using the 2008 beta 2 on an XP machine.

the code I'm using is:

=========
Dim s As String
s = "http://ecs.amazonaws.com/onca/xml?" & _
"Service=AWSECommerceService&" & _
"AWSAccessKeyId=1234&" & _
"AssociateTag=my-tag&" & _
"ResponseGroup=Small&" & _
"Operation=ItemSearch&" & _
"SearchIndex=Music&" & _
"Keywords=neil young"
Dim ResponseDoc As Linq.XDocument = XDocument.Load(s)
Dim ReturnedItems = From ReturnedItem In
ResponseDoc.Descendants("Item") _
Select ASIN = ReturnedItem.Element("ASIN").Value, _
URL = ReturnedItem.Element("DetailPageURL").Value

===========

ReturnedItems is always empty.

Am I doing something wrong? Is Amazon XML wrong in some way?
Can you show us a sample of the XML you are trying to process? As the
web service requires an access id it is easier to help you if you
provide the XML sample.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Reply With Quote
  #3  
Old   
Martin Honnen
 
Posts: n/a

Default Re: LINQ to XML and Amazon Webservices - 09-20-2007 , 10:57 AM



mudGil wrote:

Quote:
Am I doing something wrong? Is Amazon XML wrong in some way?
Those elements are in a namespace so one way with VB and LINQ is as
follows, put the following two lines

Imports System.Xml.Linq
Imports
<xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">

at the beginning of your program, then inside your program use the
following syntax:

Dim ResponseDoc As XDocument = XDocument.Load(s)
Console.WriteLine(ResponseDoc.ToString())
For Each item As XElement In ResponseDoc...<Item>
Console.WriteLine("ASIN: {0}", item.<ASIN>.Value)
Next


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Reply With Quote
  #4  
Old   
WenYuan Wang [MSFT]
 
Posts: n/a

Default RE: LINQ to XML and Amazon Webservices - 09-27-2007 , 04:03 AM



Hello mudGil,

Due to VS 2008 has not been final released so far, LINQ issue is not
supported by MSDN Managed Newsgroup Team.
If you have issue related to LINQ, you may also post it in MSDN Forum,
http://forums.microsoft.com/MSDN/Sho...D=123&SiteID=1
The people in those groups will be more likely to be able to help and
familiar in such field.

If you have any more concern, please also feel free to update here. It's my
pleasure to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
  #5  
Old   
Clay Joslin
 
Posts: n/a

Default Re: LINQ to XML and Amazon Webservices - 12-24-2007 , 09:08 PM



WenYuan Wang [MSFT] wrote:
Quote:
Hello mudGil,

Due to VS 2008 has not been final released so far, LINQ issue is not
supported by MSDN Managed Newsgroup Team.
If you have issue related to LINQ, you may also post it in MSDN Forum,
http://forums.microsoft.com/MSDN/Sho...D=123&SiteID=1
The people in those groups will be more likely to be able to help and
familiar in such field.

If you have any more concern, please also feel free to update here. It's my
pleasure to assist you.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Why did this happen to end up on my computer????????////


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.