Tải bản đầy đủ (.pdf) (24 trang)

How to Do Everything with Web 2.0 Mashups phần 10 potx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (897.54 KB, 24 trang )

280 How to Do Everything with Web 2.0 Mashups
How to . . .
■ Decide on Your Mashup’s Objective
■ Identify the Data and the Keys
■ Get Access to the Data
■ Design the User Interface
■ Implement the Mashup
■ Implement the Starting Page
T
his last chapter brings together two complex APIs: Google mapping and eBay searching. It
has the same structure as all the mashups you have already seen, and the APIs were already
discussed. Creating mashups is just a matter of deciding what specific insight you have about
how to combine or display information, and then applying the standard mashup structures to that
idea.
Decide on Your Mashup’s Objective
This mashup lets you search eBay for items using keywords. When it finds results, it returns
them in an XML document. From that document, it extracts the title of each item and its price,
as well as the location of the seller. These items are then mapped on a Google map with markers
providing that information, as well as a link to the actual eBay listing page for the item.
Identify the Data and the Keys
The data come from eBay and use the Google mapping API. This is an example, and it makes
some assumptions that are not valid in real life. For example, the mapping API is relying on U.S.
ZIP codes. Other postal codes (as well as items with incorrect postal codes) should be omitted or
shown in a separate table. Also, you might want to trap errors in processing by checking the Ack
element of the returned XML.
Get Access to the Data
As noted in the previous chapter, you need various keys to access the eBay API. You also need
your Google access key for the mapping API.
Simpo PDF Merge and Split Unregistered Version -
CHAPTER 19: Map the Locations of eBay Items 281
Design the User Interface


The mashup is shown in Figure 19-1. The eBay data are only displayed inside the markers. If you
want, you could add another section to the page, so the text of the listings is displayed above or
below the map.
FIGURE 19-1
The eBay/Google maps mashup
19
Simpo PDF Merge and Split Unregistered Version -
282 How to Do Everything with Web 2.0 Mashups
Implement the Mashup
This is the major part of this chapter and it is short because so much code is being reused.
Implement the Page Top Include
This include file needs your Google mapping key, as well as either REST or SOAP keys for
eBay. Here is the REST version:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
" /><html xmlns=" /><head>
<title><?php echo $page_title; ?></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<script src="
file=api&amp;v=2&amp;
key=yourKey"
type="text/javascript"></script>
<?php
define ('requestToken', 'yourRESTToken');
define ('requestUserId', 'youreBayUserID');
?>
And, here is the SOAP version:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

" /><html xmlns=" /><head>
<title><?php echo $page_title; ?></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<script src=" /> key=yourKey"
type="text/javascript"></script>
<?php
define ('DevID', 'yourDevID');
define ('AppID','yourAppID');
define ('CertID', 'yourCertID);
define ('UserToken', 'yourToken');
?>
Simpo PDF Merge and Split Unregistered Version -
CHAPTER 19: Map the Locations of eBay Items 283
Implement the PHP Code
The code from Chapter 12 is reused here for the mapping. That code is presented with the bodies
of the functions removed.
Create the Top of the File
This is the beginning of the PHP file:
<?php
$page_title = "Chapter 19";
include ('./Includes/PageTop.html');
?>
<! from Chapter 12 >
<script type="text/javascript">
//<![CDATA[
var map = null;
var geocoder = null;
function createMap () {
}

function setMarkerAndText (mapPoint, text, icon) {
}
function showAddress (latitude, longitude, address, addressText, icon) {
} //showAddress
//]]>
</script>
<! end Chapter 12 >
Create get_subnodes to Parse Returned XML
The XML to be returned has subnodes of the returned items. A variation of the get_subnodes
function is used here. When used with Amazon data, the function checked to see if it needed to
create a link to the item. Here, a more generalized form is used. The chief architectural difference
is this: the function receives a string ($returnString) to which it adds the data it finds. Then, the
function returns the string.
The function searches $theNode for a subnode named $nodeName, just as before. It then
adds $nodeTitle (if that string exists) and the values of all the found subnodes and returns the
string.
19
Simpo PDF Merge and Split Unregistered Version -
284 How to Do Everything with Web 2.0 Mashups
<?php
function get_subnodes ($theNode, $nodeName, $nodeTitle, $returnString) {
$theSubnodes = $theNode->getElementsByTagName ($nodeName);
if ($nodeTitle)
$returnString .= $nodeTitle;
foreach ($theSubnodes as $theSubnode) {
$returnString .= $theSubnode->nodeValue;
}
return $returnString;
}
?>

Create sendHttpRequest for SOAP
Following this, the PageTop2.html file is included, and there are some slight variations for the
REST and SOAP versions. In the case of SOAP, the sendHttpRequest function, described in the
previous chapter, is added.
<?php
function sendHttpRequest($userRequestToken, $developerID,
$applicationID, $certificateID, $useTestServer,
$compatabilityLevel, $siteToUseID, $callName, $requestBody) {
}
Do Nothing for REST
In the case of the REST version, you simply open this section of PHP code:
<?php
Set Variables for the Calls
In both versions, you continue with identical code to set the variables:
$theCall = "GetSearchResults";
$theSite = "US";
$SiteId = '0';
$Version = '433';
$EntriesPerPage = '4';
$PageNumber = '1';
Adjust Keywords for REST and SOAP
For REST, you replace spaces in the keywords text with + as in the following line of code:
Simpo PDF Merge and Split Unregistered Version -
CHAPTER 19: Map the Locations of eBay Items 285
$theQuery = str_replace(" ", "+", $_REQUEST['keywords']);
For SOAP, you do not need to replace blanks, as you see here:
$theQuery = $_REQUEST['keywords'];
Add H1 and DIV HTML Elements
Close this section of PHP code, and then enter the HTML header and div elements:
?>

<h1>eBay Search Results for
<?php echo $_REQUEST['keywords']; ?>
</h1>
<div id="map" style="width: 500px; height: 300px"></div>
<?php
Create the REST Call
For the last time, the two versions diverge. You create the REST call with this code:
$theURL = " /> ."CallName=".$theCall
."&RequestToken=".requestToken
."&RequestUserId=".requestUserId
."&SiteId=".$SiteId
."&Version=".$Version
."&Site=".$theSite
."&Query=".$theQuery
."&EntriesPerPage=".$EntriesPerPage
."&PageNumber=".$PageNumber
."&UnifiedInput=1"
;
$xml = file_get_contents($theURL);
Create the SOAP Call
You create the SOAP call with this code:
19
Simpo PDF Merge and Split Unregistered Version -
286 How to Do Everything with Web 2.0 Mashups
$requestXmlBody = '<?xml version="1.0" encoding="utf-8" ?>';
$requestXmlBody .= '<';
$requestXmlBody .= $theCall;
$requestXmlBody .= ' xmlns="urn:ebay:apis:eBLBaseComponents">';
$requestXmlBody .= "<RequesterCredentials><eBayAuthToken>";
$requestXmlBody .= UserToken;

$requestXmlBody .= "</eBayAuthToken></RequesterCredentials>";
$requestXmlBody .= "<Query>";
$requestXmlBody .= $theQuery;
$requestXmlBody .= "</Query>";
$requestXmlBody .= "<Pagination>";
$requestXmlBody .= "<EntriesPerPage>";
$requestXmlBody .= $EntriesPerPage;
$requestXmlBody .= "</EntriesPerPage>";
$requestXmlBody .= "<PageNumber>";
$requestXmlBody .= $PageNumber;
$requestXmlBody .= "</PageNumber>";
$requestXmlBody .= "</Pagination>";
$requestXmlBody .= '</';
$requestXmlBody .= $theCall;
$requestXmlBody .= '>';
$responseXml = sendHttpRequest(UserToken, DevID, AppID,
CertID, true, $Version, $SiteId, $theCall, $requestXmlBody);
Parse the Returned Document
You parse the XML results just as you did before. The revised get_subnodes function lets you
construct the string that will appear in each marker:
$doc = new DOMDocument();
$doc->loadXML($xml);
$root = $doc->documentElement;
if ($root) {
$results = '';
$theNodes = $doc->getElementsByTagName('Item');
foreach ($theNodes as $theNode) {
Simpo PDF Merge and Split Unregistered Version -
CHAPTER 19: Map the Locations of eBay Items 287
Construct the marker string for each item returned. The only piece of this code that was

not presented previously is the link in the marker. You do that by constructing the HTML, as
shown here.
Constructing the HTML in the marker can be tricky with all the quotation marks. For
debugging, add an echo statement to echo $theString, so you can see what you created.
Errors are usually easy to spot visually.
$theString = '';
$theString =
get_subnodes ($theNode, 'ViewItemURL',
'<a href="', $theString);
$theString =
get_subnodes ($theNode, 'Title', '">',
$theString);
$theString .= "</a><br>";
$theString = get_subnodes ($theNode, 'CurrentPrice',
' Price: ', $theString);
Set the variable for the postal code of the seller. Note, you must set it to an empty string first
because it is inside a loop and the new get_subnodes function adds on to whatever text is already
there.
$thePostalCode = '';
$thePostalCode = get_subnodes ($theNode,
'PostalCode', '', $thePostalCode);
Finally, echo out a script to call the showAddress JavaScript function with the variables you
just created:
echo ('<script type="text/javascript">');
echo ("showAddress(0, 1, '"
.$thePostalCode.
"', '"
.$theString.
"');");
echo ('</script>');

}
}
19
Simpo PDF Merge and Split Unregistered Version -
288 How to Do Everything with Web 2.0 Mashups
Close the Script
Add the standard closing of the script and you are finished:
?>
<?php
include ('./Includes/PageBottom.html');
?>
Implement the Starting Page
You can use the same starting page you used previously. All you need to remember is to set the
form action to the name of this PHP file and to make certain you have a keywords field.
What’s Next?
This chapter shows you how to map the results of an eBay query, placing information about the
items into the markers you place on a map. You can use it as the basis for further adventures.
For example, remember the text in a Google Map marker is, in fact, HTML. This means you
could pull the PictureURL out of the PictureDetails block in the eBay search results and display
a product photo in the Map marker (reducing or enlarging it in size with the width and height
attributes). As you have seen, mashups bring together a lot of technologies, each one of which is
simple (or at least used simply) in the world of mashups.
Few things are more basic in the world of HTML than inserting an image into HTML. That
simple procedure, when combined with the eBay API and the Google mapping API, can provide
you with an exciting mashup. The only thing to remember is this: your space can be somewhat
limited inside the marker, so you might want to use a link instead of (or in addition to) an image.
As you saw in this book, mashups use a few pieces of many technologies to accomplish
their goal of displaying multiple data sources or multiple presentations of the same data. You’ve
seen how mashups start from a simple search term and use it to search Google, Flickr, eBay, or
Amazon. You’ve seen how you can chain queries so that, for example, a search term to Flickr

uses the Flickr API to find related terms, which, in turn, are sent to Google search.
As long as you understand the data involved (particularly common values that can be used to
match data from two sources), you can use the basic techniques here to create an infinite number
of mashups. In fact, once you create a few mashups using the code in this book, the basics become
almost second nature to you. Then, the fun part begins: working with the data and the people who
are interested in it. A basic knowledge of HTML helps you to create Web pages, but a few hours in
the world of mashups (and using examples in this book) can help you know where to go to convert
among various geographical locations—latitude/longitude, counties, ZIP codes, and the like.
You can also push beyond the basics of mashups that start from a given query that is typed
in. Wherever you can find text that is useful for a search, you can begin to build a mashup. And
text is everywhere.
For example, you can use Image Functions in PHP (
to retrieve the metadata stored in the headers of JPEG and TIFF files. While many people access
Simpo PDF Merge and Split Unregistered Version -
CHAPTER 19: Map the Locations of eBay Items 289
that information to find the original size of the image, many other fields can tempt the mashup
designer. You can find more information about some of the data available at the International
Press Telecommunications Organization page ( />If you want to explore this area, there is little to do beyond what you have already seen. All
you do is replace the search text field used on so many of the mashup start pages with a field that
either contains an image or a URL (possibly local to the user’s computer) that locates the image.
If the image contains metadata, you can retrieve it in your PHP code. Digital cameras provide
exposure, date, and other data, but many programs let you enter additional data.
You can get the IPTC data as a byproduct of a call to getimagesize, where you pass in the
image as the first parameter and, optionally, receive information to parse in the second parameter:
$size = getimagesize("yourimage.jpg", $info);
Then, you check to see if you have data to parse:
if (isset($info["APP13"])) {
$iptc = iptcparse ($info["APP13"]);
You now have an array with the various data fields available from the image. Two that might
be of interest are the caption and the headline:

$headline = $iptc["2#105"][0];
$caption = $iptc["2#120"][0];
At that point, you close the if statement:
}
With either (or both) of those strings, you are ready to launch the same kind of searches you
saw in the examples in this book. Just use $headline or $caption where you have used variables
such as $keyword, and away you go.
The standards are under development at press time, so check out the IPTC Web site and
the PHP link shown here to get the latest info and examples.
Keep your eyes open for the mashup opportunities in the data to which you have access.
One of the most important aspects of the Web as it is evolving is that not only does it contain
vast stores of data (such as the population, statistical, and campaign contributions data used in
this book), but it also contains localized and specific data, either as parts of these large databases
or as stand-alone resources. The mashup developer understands such a specific dataset. The
developer who can create a mashup to help friends, neighbors, and colleagues understand the
data they deal with every day on a superficial level is a valuable addition to a corporation, a
community, or any other group.
Designing mashups lets you help people to move beyond the minutiae of data points to an
understanding of the realities the data suggest. Few technologies today have such far-reaching
possibilities.
19
Simpo PDF Merge and Split Unregistered Version -
This page intentionally left blank
Simpo PDF Merge and Split Unregistered Version -
291
Index
Number
1001 Fishing Holes mashup, 9
Symbols
. (concatenation operator), using in PHP connection

to SQL database, 88
// (comments)
using in JavaScript scripts, 51–52
using in PHP, 65
/* */ comments, using in PHP, 65
@ (at sign), using with variables in MySQL, 93
\ (backslash), continuing quoted text strings
with, 50–51
+ (concatenation operator), continuing quoted text
strings with, 50–51
. (concatenation operator), using in PHP connection
to SQL database, 88
<! > (comments), including in XHTML
documents, 134
<? php and ?> delimiters, using, 65, 73
<<<, preceding heredoc sections with, 70
= (equal sign), using with concatenated strings, 71
“ ” (double-quotes)
matching for maps, 176–177
using in PHP, 69–70
; (semicolons)
separating JavaScript code lines with, 52
separating JavaScript statements with, 50
using with commands in MySQL, 86
‘ ’ (single-quotes)
matching for maps, 176–177
using in PHP, 69–70
A
accessor routines, getters and setters in, 31
action attribute, using in form element, 67, 110

Ad Generator mashup, 13
addresses, showing in Google Maps API, 175
AJAX (Asynchronous JavaScript and XML),
explanation of, 4
alert function, purpose in JavaScript, 56
Amazon accounts
setting up associate account, 208–209
setting up basic account, 207
setting up Web Services account, 209–210
Amazon API
building links in, 214–216
determining, 211
identifiers for, 211
Amazon mashup. See also mashup examples
accessing data in, 228
adding debugging code to, 236–239
adding error-checking to, 238–239
architecture for, 228–229
coding, 231–235
designing user interface for, 228
determining objectives for, 226
identifying data and keys for, 227
implementing starting page for, 235–236
testing error-checking code for, 239–240
Amazon search REST query, conducting, 214
Amazon searches
conducting, 211–212
versus Flickr XML architecture, 249–250
using, 234
Amazon Services, locating, 207

Amazon shopping cart, building, 216–218
Amazon Standard Item Number (ASIN)
selecting in Amazon API, 214–215
using in Amazon API, 211
Amazon Web Services (AWS) account
free accounts, 211
setting up, 209–210
American FactFinder, using with population data
mashup, 145
AND clauses, removing from population data
mashup, 160
Apache Web server, downloading, 144
API Explorer, using with Flickr API, 246–250
API Test Tool, using with eBay API, 267–271
APIs (application programming interfaces),
accessing data with, 18–19, 30–31
Application ID, using with eBay API, 266
arguments, purpose in Flickr API, 246, 248
art, creating with mashups, 11–13
ASIN (Amazon Standard Item Number)
selecting in Amazon API, 214–215
using in Amazon API, 211
AssociateTag identifier, using in Amazon API, 213
Asynchronous JavaScript and XML (AJAX),
explanation of, 4
at sign (@), using with variables in MySQL, 93
Simpo PDF Merge and Split Unregistered Version -
292 How to Do Everything with Web 2.0 Mashups
Atom feed, example of, 108–109
Atom format. See also feeds; RSS feeds

resources for, 98
versus RSS feeds, 101–102
“Attacking AJAX Applications,” obtaining, 116
Attentionmeter.com mashup, 8
attributes. See also keys
identifying data characteristics with, 44–45
picking up from DOMElements, 110
of XHR object, 118
in XHTML, 135
authentication, requirement for Flickr API, 245
AWS (Amazon Web Services) account
free accounts, 211
setting up, 209–210
B
<b> and </b> tags, using, 41–43
backslash (\), continuing quoted text strings
with, 50–51
best practices, following for programming, 52
BLS (Bureau of Labor Statistics), obtaining data
from, 148–150
bold formatting, specifying in HTML, 41–42
<br> tag, using in campaign contributions
mashup, 202
browsers
standards-compliance of, 130
support for JavaScript, 57
browser-side scripting, using, 30
Build Links tool
using with Amazon API, 214–216
using with Amazon mashup, 231

Bureau of Labor Statistics (BLS), obtaining data
from, 148–150
C
calculations, performing in MySQL, 94
callback function
creating for Google Maps API, 173
setting for Google Search API, 223
campaign contributions mashup. See also mashup
examples
accessing data in, 194–196
designing user interface for, 199
determining objectives for, 192–193
identifying data and keys for, 193–194
implementing, 200–202
loading committee data in, 198–199
candidates in FEC database, description of, 84
catch statement, purpose in JavaScript events, 56
category element, using with labels, 109
Certificate ID, using with eBay API, 266–267
channel element in rss element, example of, 40
client-side scripting, using, 30
code samples
+ (concatenation) operator for quoted text
string, 50
alert function displaying error message, 56
Amazon mashup, 231–232
architecture for Amazon and Google
mashup, 228–229
Atom feed, 108
browser lacking JavaScript support, 57

callback function for Google Maps API, 173
callback routine for geocoder, 171
column added in MySQL, 91
columns loaded in MySQL, 93
committee data, 198–199
concatenated strings in PHP, 71
contributions data, 196
COUNT statements, 83
curl routines for Amazon mashup, 233–234
data fetched for PHP and SQL, 89–90
data loaded into variables to skip
columns, 93
database created in MySQL, 90–91
database disconnection, 90
debugging Amazon mashup, 237
debugging test, 238–239
deleting data from databases in MySQL, 95
displaying photos in Flickr API, 251
<div> added in Google Maps API, 186
DTDs (document type declarations), 133
elements processed for feeds, 109–110
error-handling in JavaScript, 56
event syntax in JavaScript, 55
field and record delimiters changed in
MySQL, 92
Firefox XML relative to RSS, 99–100
fixed-width data in MySQL, 94
Flickr call, 248–249
Flickr echo service, 124
Flickr key in PageTop.html, 243–244

Flickr photo-tag search mashup, 259–262
Flickr URL utility function, 253
form launching script for feed, 110
FORMAT statement, 83
gazetteer table, 182
getAttribute method used with feed, 110
Google Search API, 219–220, 223–224
Google search mashup, 259–262
heredoc section, 70
HTML code for PHP, 74
HTML element in XHTML, 134
Simpo PDF Merge and Split Unregistered Version -
Index 293
HTML source code for Web page
in PHP, 72–73
ignore clause in MySQL, 92–93
Includes directory for PHP scripts, 76–77
JavaScript functions, 53
JavaScript generated from PHP, 174–177
JavaScript script in script element, 49
JSON data retrieval, 125–126
LIMIT clause in SQL, 84
load data command, 156, 197–198
LOAD DATA INFILE syntax in MySQL, 92
load function for geocoder, 170
map created in Google Maps API, 169
mapping page for Google Maps API, 168
marker for Google Maps API, 172
mashup in Google Maps API, 189–191
MySQL launched on Mac OS X, 86

namespace for XML element, 45
ORDER by statement, 83
PageTop.html files in Google
Maps API, 184–185
photo nodes extracted in Flickr
API, 252–253
PHP code for eBay search mashup, 283–288
PHP configuration test, 64
PHP connecting to SQL database, 87–88
PHP delimiters, 64
PHP script for HTML form, 67–68
PHP script to parse feed, 111
PHP strings, 69
population data mashup implementation,
159–161
query for PHP and SQL, 88–89
REST data retrieval, 124–125
REST interface for GetSearchResults,
272–273
REST request for Flickr API, 246
$row array in PHP, 75–76
rss element with channel element, 40
script element for Google Maps API, 168
search feed, 112
semicolon (;) with JavaScript script, 50
showAddress function in Google Maps
API, 187
single- and double-quotes in PHP, 70
SOAP interface for GetSearchResults,
274–277

SQL queries, 82–84
src attribute, 49
start page for Amazon and Google mashups,
235–236
start page for Flickr photo-tag search
mashup, 263
start page for Google search mashup, 263
string object in JavaScript, 54
var keyword in JavaScript, 51
XHR object, 117–118
XHR response callback, 119
XHR test script, 119–122
XHTML (Extensible Hypertext Markup
Language), 131–132
XHTML attributes, 135
XHTML element syntax, 135
XML declaration for start page, 133
XML document for parsing feeds,
106–107
XML-RPC data retrieval, 123
columns. See also keys
adding in MySQL, 91
loading in MySQL, 93
purpose of, 81
retrieving, 82
setting as result of calculation in MySQL, 94
skipping in MySQL, 93
comma-separated value (CSV), saving Excel files
as, 148–149
comments (//)

using in JavaScript scripts, 51–52
using in PHP, 65
comments (<! >), including in XHTML
documents, 134
committee data, loading in sample mashup,
198–199
committee fields, including in sample mashup,
193–194
committees in FEC database, description
of, 84
concatenated strings, building in PHP, 71
concatenation
continuing quoted text strings with, 50–51
using in PHP connection to SQL database, 88
constructor, creating for Google Search API, 224
contribution fields, including in sample mashup,
193–194
contributions data, loading in sample mashup,
196–198
controls, adding to maps, 169–170
COUNT statements, using in SQL, 83
createFlickrGetRelatedCall function, calling,
261–262
createSearchControl, calling for Google search, 262
cross-domain scripting, issues related to, 115–116
CSV (comma-separated value), saving Excel files
as, 148–149
curl library, using with PHP, 105–106
curl routines, using with Amazon mashup, 233
Simpo PDF Merge and Split Unregistered Version -

294 How to Do Everything with Web 2.0 Mashups
D
data
accessing, 18–19
accessing in campaign contributions
mashup, 193–194
accessing in Flickr photo-tag search
mashup, 257
accessing in Google Maps API, 182–183
accessing in Google search mashup, 257
accessing with APIs, 30–31
determining for mashups, 145–150
fetching for PHP and SQL, 89–90
identifying for Amazon and Google
mashup, 227
identifying for campaign contributions
mashup, 193–194
identifying for eBay search mashup, 280
identifying for Flickr photo-tag search
mashup, 256–257
identifying for Google Maps API,
180–182
identifying for Google search mashup,
256–257
identifying for mashups, 18
loading into variables to skip columns in
MySQL, 93
matching, 145
retrieving from databases in PHP, 75
separating from presentation, 27–29

setting during load process in MySQL, 94
using LIMIT clauses with, 84
data characteristics, identifying with
attributes, 44–45
data retrieval. See also JSON data retrieval; XHR
object; XML-RPC data retrieval
constructing requests for, 115
implementing with JSON, 126
implementing with REST, 124–125
implementing with XML-RPC, 123–124
receiving responses in, 115
database call, adding for population data
mashup, 160
databases
capabilities of, 80
connecting to, 75
creating in MySQL, 90–91
deleting data from in MySQL, 95
disconnecting from, 90
dropping in MySQL, 95
FEC database, 84–87
loading in MySQL, 91–94
in SQL (Structured Query Language), 81
debugging code, adding to Amazon and Google
mashups, 236–239
debugging parameters, using with Amazon
API, 212
Developer ID, using with eBay API, 266
<div> element
adding for campaign contributions

mashup, 201
adding in eBay search mashup, 285
adding in Google Maps API, 186–187
in Amazon mashup, 232
creating for Google Maps API, 176
declaring for Google Maps API, 169
for Flickr photo-tag search mashup, 260
for Google search mashup, 260
using in HTML, 38
divide-by-zero error, example of, 56
document object
importance of, 54
methods of, 54–55
document type declaration (DTD), purpose
in XHTML, 133
DOM document, converting XML documents
to, 107
DOM elements, manipulating in PHP, 107–108
domains, analyzing graphically, 8
DOMElements, picking up attributes from, 110
DOMNodeLists
getting elements from, 108
iterating through items in, 108
double-quotes (”)
matching for maps, 176–177
using in PHP, 69–70
Dreamweaver, creating Web pages with, 28–29
DTD (document type declaration), purpose in
XHTML, 133
E

eBay API. See also REST interface for
GetSearchResults; SOAP interface for
GetSearchResults
accessing, 266–267
parsing XML results for, 277
and REST interface for GetSearchResults,
271–273
using API Test Tool with, 267–271
eBay calls, getting details about, 271
eBay search mashup. See also mashup examples
accessing data in, 280
designing user interface for, 281
determining objectives for, 280
identifying data and keys for, 280
implementing page top include for, 282
Simpo PDF Merge and Split Unregistered Version -
Index 295
implementing PHP code for, 283–288
implementing start page for, 288–289
eBay seller, setting variable for postal code of, 287
echo function, using in PHP, 64, 74–75
echo service, example of, 123–124
echo statement, using with eBay search
mashup, 287
element names, using namespaces with, 45
elements, processing for feeds, 109–110. See also
HTML elements; keys; XML elements
encodings, using with XML declaration, 132–133
entities in XML, purpose of, 38–39
Epispider.org mashup, 11–12

equal sign (=), using with concatenated strings, 71
error codes, purpose in Flickr API, 246
error message, including for maps, 175
error-checking code
adding to Amazon mashup, 238
testing for Amazon mashup, 239–240
errors, handling, 55–56
escape characters, managing in Amazon API, 211
events, using in JavaScript, 55
Excel spreadsheets, opening data in, 148–149
Extensible Hypertext Markup Language (XHTML).
See XHTML (Extensible Hypertext Markup
Language)
Extensible Markup Language (XML). See XML
(Extensible Markup Language)
F
FEC database, using, 84–87
Federal Information Processing Standard (FIPS)
codes, using, 180
feeds. See also Atom format; RSS feeds
categorizing and labeling, 102–103
creating search feed, 111–112
feeds, explanation of, 99
parsing with PHP scripts, 111
processing elements for, 109–110
XML document for, 104–110
field delimiters, changing in MySQL, 92
fields, skipping over in MySQL, 93. See also keys
file_get_contents
using in Flickr API, 252

using in Flickr photo-tag search mashup, 260
using in Google search mashup, 260
findneraby.net mashup, 7
FIPS (Federal Information Processing Standard)
codes, using, 180
fixed-width data, reading in MySQL, 94
Flickr API
accessing, 244
arguments in, 246, 248
avoiding XML parsing pass in, 254
displaying photos in, 250–253
option values for image sizes in, 252
searching photos in, 246–250
Flickr call, creating, 248–249
Flickr echo service code sample, 123–124
Flickr key
obtaining, 243–245
placing in PageTop.html, 243–244
Flickr photo-tag search mashup. See also mashup
examples
accessing data in, 257
creating iframe elements for, 261
designing user interface for, 258
determining objectives for, 256
identifying data and keys for, 256–257
implementing, 258–262
picking up photo nodes in, 260–261
Flickr URLs, building, 253
Flickr XML architecture versus Amazon
search, 249–250

flickr.photos.search API page,
sections of, 245–246
foreach statement, using in PHP, 108–109
form element, using action attribute in, 67, 110
FORMAT statements, using in SQL, 83
frameset DTD, example of, 133
Free Software Foundation Web site, 63
full-page loading, minimizing, 31–32
functions, creating and using
in JavaScript, 52–53
G
Gazetteer files, downloading, 180
gazetteer table, creating table for, 182
GClientGeocoder object, using with maps, 170
geocoders
declaring for Google Maps API, 174
using with Google Maps API, 170–171
get_subnodes function
creating for eBay search mashup, 283–284
declaring for Amazon mashup, 232
getAttribute method, using with feeds, 110
getElementById function, using with Google Maps
API, 168
getElementsByTagName method, using with
DOMElement, 108
GetSearchResults
using REST interface for, 271–273
using SOAP interface for, 274–277
getters, role in accessor routines, 31
GLatLng, identifying locations with, 170

global variables, using in JavaScript, 51–52
Simpo PDF Merge and Split Unregistered Version -
296 How to Do Everything with Web 2.0 Mashups
Google Maps API. See also mashups in Google
Maps API
accessing, 164–166
accessing data in, 182–183
creating callback function for, 173
creating maps in, 169–170
creating markers in, 172
identifying data and keys for, 180–182
identifying locations in, 170
including script element for, 168
loading records in, 182
reading mapping page of, 167–169
showing addresses in, 175
using geocoders with, 170–171
Google Maps API
using with mashups, 6
Web site for, 166
Google mashup. See also mashup examples
accessing data in, 228
adding debugging code to, 236–239
architecture for, 228–229
coding, 230
designing user interface for, 228
determining objectives for, 226
identifying data and keys for, 227
implementing starting page for, 235–236
Google Search API, using, 218–224

Google search feeds, examples of, 112
Google search mashup. See also mashup examples
accessing data in, 257
designing user interface for, 258
determining objectives for, 256
identifying data and keys for, 256–257
implementing, 258–262
granularity of data, importance of, 145
GROUP function, using with campaign
contributions mashup, 201–202
GSearchControl object, using with Google Search
API, 221
H
H1 element, adding to eBay search mashup, 285
Harley-Davidson Great Roads Explorer
mashup, 9–10
HEAD element, creating in Google Maps API,
184–185
heredoc construct
using in Amazon mashup, 233
using in PHP, 70–71
HTML (HyperText Markup Language)
advantages and disadvantages of, 129
constructing in marker string, 287
development of, 27–28
modifying to add <div> in Google Maps
API, 186–187
specifying bold and italic formatting
in, 41–42
using <div> element in, 38

versus XHTML (Extensible Hypertext
Markup Language), 129
versus XML (Extensible Markup Language),
37, 41
HTML code
emitting with echo function, 75
entering large chunks of, 71
HTML elements. See also elements
grouping, 38
nesting, 43
purpose in XHTML, 134
HTML forms, using with PHP scripts, 65–69
HTML source code, using with Web pages
in PHP, 72–76
HTTP POST request, using with XML-RPC, 123
Hypertext Preprocessor (PHP). See PHP (Hypertext
Preprocessor)
I
<i> and </i> tags, using, 42–43
IE (Internet Explorer), scripting features
in, 58–59
iframe elements, creating for Flickr photo-tag
search mashup, 261
ignore clause, using in MySQL, 92–93
Image Functions, using in PHP, 288–289
images
disabling loading of, 57
turning off, 58
include files
for Amazon mashup, 235

for population data mashup, 159
Includes directory, creating for PHP scripts, 76–77
individuals in FEC database, description of, 84
information
targeting with mashups, 17
types of, 8–11
InfoWindow
creating in Google Maps API, 172
opening, 173
International Press Telecommunications
Organization Web page, accessing, 289
Internet Explorer 7, RSS news feed in, 37, 40
Internet Explorer (IE), scripting features in, 58–59
ISBN (International Standard Book Number)
selecting in Amazon API, 214–215
using in Amazon API, 211
italic formatting, specifying in HTML, 41–42
Simpo PDF Merge and Split Unregistered Version -
Index 297
items. See keys
ItemSearch parameters, using with Amazon API, 214
J
JavaScript
alert function in, 56
browser support for, 57
case-sensitivity of, 51
creating and using functions in, 52–53
error handling in, 55–56
events in, 55
generating from PHP, 174–177

handling environmental problems in, 57–59
resources for, 48
structure of, 49–51
testing enabled status of, 57
throw statements in, 56
using local and global variables in, 51–52
JavaScript code, entering large chunks of, 71
JavaScript objects, using, 54–55
JavaScript preferences, configuring in Safari, 57–58
JavaScript scripts. See also scripts
continuing quoted text strings in, 50–51
ending statements in, 50
improving readability of, 51
interpretation of, 50
placing in script elements, 49
using spaces and comments with, 51
JSON data retrieval, implementing, 126. See also
data retrieval
JSON protocol, Web resource for, 114
K
keys. See also attributes; columns; elements; fields
basing rows in SQL on, 81
determining for mashups, 145–150
getting for Flickr API, 243–244
identifying for Amazon and Google
mashup, 227
identifying for campaign contributions
mashup, 193–194
identifying for eBay search mashup, 280
identifying for Flickr photo-tag search

mashup, 256–257
identifying for Google Maps API, 180–182
identifying for Google search mashup,
256–257
identifying for mashups, 18
using with AWS (Amazon Web Services)
accounts, 210
using with Google Maps API, 165
keywords, using in eBay search mashup,
280, 284–285
keywords field, using with Amazon mashup,
232, 234
L
labels, implementing for feeds, 109
labor force data. See also population data mashup
loading into MySQL, 152–155
using, 148–150
$latlng array, using in Google Maps API, 188
length property, accessing for string object, 54
libraries, simplifying XHR requests with, 123
LIMIT clauses
using in MySQL, 95
using in SQL, 84
link element, example of, 45
links, building in Amazon API, 214–216
listeners, adding to maps, 173
load data command
for campaign contributions mashup, 197–198
using with population data mashup, 156
LOAD DATA INFILE command

combining features of, 94
using in MySQL, 91–92, 94
load function, using with geocoders, 170
load process, setting data during, 94
local keyword, using with LOAD DATA INFILE
command, 92
local variables, using in JavaScript, 51–52
M
Mac OS X, launching MySQL on, 86
MakeFlickrImageURL() function code sample, 253
mapping APIs, capabilities of, 5
mapping page, reading in Google Maps API, 167–169
mapping scripts, adding in Google Maps API,
184–186
maps, 174
adding listeners to, 173
creating center points for, 170
creating in Google Maps API, 169–170,
174–175
drawing in Google Maps API, 189–192
including error messages for, 175
marker string, constructing for eBay search
mashup, 287
markers
adding text to, 173
creating in Google Maps API, 172, 189–190
purpose of, 5
mashup data, legal use of, 21
Simpo PDF Merge and Split Unregistered Version -
298 How to Do Everything with Web 2.0 Mashups

mashup examples. See also Amazon mashup;
campaign contributions mashup; eBay search
mashup; Flicker photo-tag search mashup;
Google mashup; Google search mashup;
population data mashup
Ad Generator, 13
Attentionmeter.com, 8
Epispider.org, 11–12
findneraby.net, 7
Fishing Holes, 9
Harley-Davidson Great Roads Explorer, 9–10
OpenSecrets.org Travel Database, 10–11
Property Listing Maps, 5
TutorLinker.com, 6
mashups
building, 17–20
capabilities of, 5, 7
creating art with, 11–13
deciding on objectives for, 18
definition of, 16
designing user interaction for, 19
determining data and keys for, 145–150
determining objectives for, 144
identifying data and keys for, 18
implementing, 19
implementing starting pages for, 20
improving productivity with, 21
making money with, 20
making visible to search engines, 32–33
providing information with, 8–11

relevance of XHTML to, 130–131
results page of, 130
selling things with, 5–7
start page of, 130
targeting information with, 17
types of, 16–17
mashups in Google Maps API. See also Google
Maps API
adding mapping scripts for, 184–186
adding SELECT statement in, 187–189
drawing maps in, 189–192
modifying HTML to add <div> in, 186–187
mashups_sql. See population data mashup
messages, displaying with alert function, 56
methods
of document object, 54–55
versus functions, 54
money, making with mashups, 20
Mozilla Developer Center Web site, 48
multisource mashups, using, 16
MySQL
changing field and record delimiters in, 92
creating databases in, 90–91
deleting data from databases in, 95
downloading, 87, 144
dropping tables in, 95
loading columns in, 93
loading databases in, 91–94
loading population data into, 155–157
performing calculations in, 94

reading fixed-width data in, 94
selecting data from tables in, 95
setting data during load process in, 94
skipping columns in, 93
using, 86
using ignore clause in, 92–93
using SELECT statements in, 95
MySQLLogin.php script, using with population
data mashup, 159
N
namespaces, using with element names, 45
NASA Web site, 57
numeric arrays, using in PHP, 69
O
objects
using in JavaScript, 54–55
using with PHP DOM module, 108
onload event, generation of, 55
onload handler
using with Google Maps API, 169
using with Google Search API, 222
onreadystatechange call-back function, using with
XHR object, 118
onUnload event, importance of, 55
onunload handler, using with Google
Maps API, 169
OOP (object-oriented programming), using, 33
open method, calling for XHR object, 118
OpenSecrets.org Travel Database mashup, 10–11
Opera, RSS news feed in, 37–38

operation formatting parameters, using with
Amazon API, 211–212
ORDER by statements, sorting tables with, 83
P
page title, setting in PHP, 74
$pageTitle variable, restructuring, 76–77
PageTop.html
for eBay API, 272
Flickr key in, 243–244
for Flickr photo-tag search mashup, 258
for Google and Amazon searches, 229
Simpo PDF Merge and Split Unregistered Version -
Index 299
for Google Maps API, 184–185
for Google search mashup, 258
parameters, using with Amazon API, 211–214
photo nodes
extracting in Flickr API, 252
picking up in Flickr photo-tag search
mashup, 260–261
photos
displaying in Flickr API, 250–253
searching in Flickr API, 246–250
PHP (Hypertext Preprocessor)
accessing SQL databases with, 87–90
building concatenated strings in, 71
building Web pages with, 72–76
curl library of, 105–106
downloading, 144
features of, 62

generating JavaScript code from, 174–177
manipulating DOM elements in, 107–108
resources for, 63
support for, 63
using comments in, 65
using heredoc construct in, 70–71
using Image functions in, 288–289
using single- (’) and double-quotes (”) in,
69–70
PHP arrays, using, 69
PHP code
for campaign contributions mashup,
200–201
concatenating, 176
implementing for eBay search mashup,
283–288
PHP configuration, checking, 64
PHP delimiters, using, 64–65
PHP DOM module, using objects with, 108
PHP files, structuring, 76–77
PHP operations, controlling, 72
PHP scripts
creating Includes directory next to, 76–77
implementing to parse feed, 111
using HTML forms with, 65–69
PHP statements, terminating, 65
PHP strings, using, 69–71
PHP variables, using, 69
population data mashup. See also labor force data;
mashups

adding database call for, 160–161
description of, 144
designing user interface for, 158
identifying data and keys for, 145–150
implementing, 158–162
implementing starting page for, 162
testing data in, 157
testing script for, 160
presentation, separating data from, 27–29
presentation mashups, using, 17
Production environment, using with eBay API, 266
productivity, improving with mashups, 21
programming best practices, following, 52
properties, relationship to JavaScript objects, 54
proxies, using in cross-domain scripting, 115–116
Q
qualifiers, using with SQL statements, 82–83
queries
creating and processing for PHP and SQL,
88–89
creating in SQL (Structured Query
Language), 82–84
quoted text strings, continuing in JavaScript scripts,
50–51
R
RawSearchControl, using with Google Search API,
222–224
readyState attribute, using with XHR object, 118
real estate, using mashups in, 5–6
Really Simple Syndication (RSS)

features of, 99–101
resources for, 99
record delimiters, changing in MySQL, 92
records
ignoring in MySQL, 92–93
loading in Google Maps API, 182
$_REQUEST variable, using in PHP, 75
requests
constructing for data retrieval, 115–116
creating for REST interface for
GetSearchResults, 273
creating for SOAP interface for
GetSearchResults, 274–275
executing for REST interface for
GetSearchResults, 273
executing for SOAP interface for
GetSearchResults, 276–277
resources, getting data from, 19
ResponseGroup identifier, using in Amazon API,
213–214
responses, receiving in data retrieval, 115–116
REST call, creating for eBay search mashup, 285
REST data retrieval. See also data retrieval
adjusting keywords for, 284–285
implementing, 124–125
Simpo PDF Merge and Split Unregistered Version -
300 How to Do Everything with Web 2.0 Mashups
REST interface for GetSearchResults, using with
eBay API, 271–273
REST keys, creating for eBay search mashup, 282

REST protocol, Web resource for, 114
REST query, using with Amazon API, 214
REST requests
sending in Flickr API, 246
using with Amazon API, 211–212
REST token, creating for eBay API Test Tool, 268
result page
advisory about XHTML code used with, 131
features of, 130, 162
validating during development, 136
$root variable, using with PHP and DOM
elements, 107
$row array, using with PHP, 75–76
rows in SQL
purpose of, 81
retrieving based on keys, 81
rsp element, using in Flickr calls, 249
RSS (Really Simple Syndication)
features of, 99–101
resources for, 99
rss elements, using attributes with, 44–45
RSS feeds. See also Atom format; feeds
examples of, 37–42
resources for, 98
structure of, 100–101
using XML elements in, 43–44
S
Safari
configuring JavaScript preferences in, 57–58
RSS news feed in, 37, 39

Sandox environment, using with eBay API, 266
script elements
including for Google Maps API, 168
placing JavaScript scripts in, 49
scripts. See also JavaScript scripts
security concerns related to, 57
turning of, 57
using, 29–30
using src attribute with, 49
search engines, making mashups visible
to, 32–33
search feed, creating, 111–112
search objects, using with Google Search API,
222–223
security, concerns related to scripts, 57
SELECT statements
adding in Google Maps API, 187–189
examples of, 82–83
for FEC database, 85–86
using in MySQL, 95
using with campaign contributions
mashup, 201
semicolons (;)
separating JavaScript code lines with, 52
separating JavaSCript statements with, 50
using with commands in MySQL, 86
send method, calling for XHR object, 118
sendHttpRequest for SOAP, creating for eBay
search mashup, 284
server-side scripting, using, 30

SET command, using in MySQL, 94
setCenter method, using with Google Maps
API, 170
setMarkerAndText function, using in Google Maps
API, 189–190
setters, role in accessor routines, 31
shopping cart, building in Amazon, 216–218
showAddress function
calling in eBay search mashup, 287
using in Google Maps API, 175,
186–187, 189–190
Simple Object Access Protocol (SOAP), adjusting
keywords for, 284–285
single-quotes (’)
matching for maps, 176–177
using in PHP, 69–70
SOAP (Simple Object Access Protocol), adjusting
keywords for, 284–285
SOAP call, creating for eBay search mashup,
285–286
SOAP interface for GetSearchResults, using with
eBay API, 274–277
SOAP keys, creating for eBay search mashup, 282
SOAP response, receiving from REST request in
Flickr API, 246
spreadsheets, opening data in, 148–149
SQL (Structured Query Language)
summary functions in, 83
terminology for, 81
SQL code, entering large chunks of, 71

SQL databases, accessing with PHP, 87–90
SQL queries, creating, 82–84
SQL statements, using qualifiers with, 82–83
SQL syntax, testing outside mashup in Google
Maps API, 187–188
src attribute
using with Google Search API, 219, 221
using with JavaScripts, 49
standards, adopting, 33–34
start page
for Amazon and Google mashups, 235–236
for campaign contributions mashup, 203
Simpo PDF Merge and Split Unregistered Version -
Index 301
features of, 130
for Flickr photo-tag search mashup, 262–263
for Google search mashup, 262–263
implementing, 162
implementing for eBay search mashup,
288–289
XHTML code for, 131–132
State and Local Unemployment Rates Web page,
accessing, 148
statements, ending in JavaScript scripts, 50
strict DTD, example of, 133
string object, creating in JavaScript, 54
strings, creating with white space in PHP, 70
stubs, using with JavaScript functions, 53
style sheet
for Google search, 229

using with Google Search API, 219–220
substring function, splitting variables with, 182–183
summary functions, using in SQL, 83
syndication, explanation of, 99
T
tab-delimited text file, saving Excel files as, 148–149
tables
checking after loading, 157
creating for gazetteer table, 182
creating in MySQL, 90
deleting data from, 95
dropping in MySQL, 95
selecting data from in MySQL, 95
tables in SQL
creating in FEC database, 84–87
joining, 82
purpose of, 81
sorting, 83
tags
<? php and ?>, 65
<b> and </b>, 41–43
<br> tag, 202
<i> and </i>, 42–43
using in HTML and XML, 41–43
$theTitle, setting, 109
$theURL, setting for search feed, 112
throw statement, purpose in JavaScript events, 56
title element
components of, 45
including for feeds, 109

token
creating for eBay API Test Tool, 268–269
defining for REST interface for
GetSearchResults, 272
defining for SOAP interface for
GetSearchResults, 274
transitional DTD, example of, 133
try/catch architecture, using with JavaScript
events, 55
type attribute, using with JavaScript scripts, 49
U
Unemployment Rates Web page, accessing, 148
Universal Product Code (UPC)
selecting in Amazon API, 214–215
using in Amazon API, 211
UPC (Universal Product Code)
selecting in Amazon API, 214–215
using in Amazon API, 211
U.S. Census mashup. See population data mashup
user ID
defining for REST interface for
GetSearchResults, 272
defining for SOAP interface for
GetSearchResults, 274
user interaction, designing for mashups, 19
user interface
designing for Amazon and Google
mashup, 228
designing for campaign contributions
mashup, 199

designing for eBay search mashup, 281
designing for Flickr photo-tag search
mashup, 258
designing for Google search mashup, 258
designing for population data mashup, 158
UTF-8 and UTF-16 encodings, using with XML
declaration, 133
V
valid XML document, explanation of, 136
validator, using with XHTML, 136–139
values
assigning to variables, 52
returning with functions, 53
variable declarations, placing together, 52
variables
assigning values to, 52
declaring, 52
loading records in, 182
setting for calls in eBay search mashup, 284
setting for postal code of eBay seller, 287
setting up for REST interface for
GetSearchResults, 273
setting up for SOAP interface for
GetSearchResults, 274
splitting with substring function, 182–183
using in JavaScript, 51–52
Simpo PDF Merge and Split Unregistered Version -
302 How to Do Everything with Web 2.0 Mashups
variables (Cont.)
using in PHP, 69

using in PHP connection to SQL database, 88
using with concatenated strings in PHP, 71
W
W3C validator, using with XHTML, 136–139
Web 2.0, origin of, 4
Web pages
building with PHP, 72–76
creating in Dreamweaver, 28–29
Web services, features of, 115
Web sites
Amazon API, 211
Apache Web server, 144
Atom format, 98
Atom format specification, 101
“Attacking AJAX Applications,” 116
curl library, 106
eBay Developer Center, 266
Flickr API page, 244
Flickr API wrapper kits, 254
Flickr specification, 250
Free Software Foundation, 63
Gazetteer files, 180
Google Maps API, 164, 166
Google Search API, 218
International Press Telecommunications
Organization, 289
JavaScript resources, 48
JSON data retrieval, 125
JSON protocol, 114
Mozilla Developer Center, 48

MySQL, 87, 144
NASA, 57
PHP (Hypertext Preprocessor), 63, 144
PHP Image Functions, 288
proxies used in cross-domain scripting,
115–116
REST protocol, 114
RSS (Really Simple Syndication), 99
RSS resources, 98
search feeds, 112
State and Local Unemployment Rates, 148
token for API Test Tool, 268
U.S. Census Bureau, 145
Webmasters documentation, 32
XHR object, 117
XHTML resources, 128
XML resource, 36
XMLHttpRequest object, 114
XML-RPC protocol, 114
Webmasters, documentation for, 32
well-formed XML document, explanation of, 136
WHERE clauses, using with SELECT statements, 83
while loop, using with campaign contributions
mashup, 202
WHILE statement, using with PHP and SQL, 89
white space, creating for strings in PHP, 70
window interface object, importance of, 54
write method, using with document objects, 54
X
XHR object. See also data retrieval

attributes of, 118
constructing and sending, 117–118
features of, 116–117
Web resource for, 114, 117
XHR requests, simplifying with libraries, 123
XHR response, handling, 118–119
XHR test script, 119–122
XHTML (Extensible Hypertext Markup Language)
versus HTML (HyperText Markup
Language), 129
validating, 136–139
Web resources for, 128
XHTML attributes, syntax for, 135
XHTML code
challenge to mashup results pages, 131
example of, 131–132
XHTML documents, including comments in, 134
XHTML elements, syntax for, 134–135
XHTML structures
DTD (document type declaration), 133
HTML element, 134
XML declaration, 132–133
XML (Extensible Markup Language)
creating samples for testing, 43
versus HTML (HyperText Markup
Language), 41
returning in eBay search mashup, 283–284
structure and purpose of, 36–38
syntax for, 38–43
XML declaration, purpose in XHTML, 132–133

XML documents
converting to DOM documents, 107
parsing for feeds, 104–110
physical and logical structures of, 38–39
RSS feeds as, 100–101
well-formed and valid types of, 136
Simpo PDF Merge and Split Unregistered Version -
Index 303
XML elements. See also elements
assigning namespaces to, 45–46
creating and using, 43–44
defining with tags, 42–43
XML results
parsing for eBay API, 277
parsing for eBay search mashup, 286–287
XML schema, significance of, 39
XMLHttpRequest object. See XHR object
XML-RPC protocol, Web resource for, 114
XML-RPC data retrieval, implementing, 123–124.
See also data retrieval
XSL parameters, using with Amazon API, 211
Y
Yahoo RSS search feed, example of, 112
yourKey reference, meaning of, 165
Z
ZIP code
input field for, 75
selecting via HTML form, 66
Simpo PDF Merge and Split Unregistered Version -

×