Here’s a quick way of testing XML/HTTP responses to make sure you’re getting the data you need.
One great thing about the XML/HTTP method of retrieving data from Amazon is that it’s easy to read the responses and know what you’re getting. Instead of relying on tools to parse the response, you can usually see exactly what data you’re working with by looking it at yourself.
This is where a browser that can display XML comes in handy. Because the requests are made with a URL over HTTP, requesting XML data is just like requesting a web page. If you’re ever puzzled by the results you’re getting from an XML/HTTP script, this is a great way to debug. Just copy the URL from your code (this may require writing the URL out to the page if you’re dynamically generating the URL) and paste it into your browser’s address field.
Some browsers are better than others at displaying XML in a human-readable form. Internet Explorer builds a nice tree outline and allows you to hide or show particular branches. Other browsers display the XML in plain text exactly as it appears in the response. Still others show a blank page, leaving you to “view the source” to see the XML.
Let’s take a simple product detail query:
insert associate tag[RETURN]
insert developer token&type=lite&f=xml&AsinSearch=
Paste this into the Address field of Internet Explorer, and you should see something like Figure 6-1.
Figure 6-1. Amazon “lite” XML ...