Datasheet
defaultCacheGet,
YAHOOFINANCE_NEWS_LIFETIME
)
);
appendDocument(
$document,
get_cached_data(
getUrlDelicious($watchRow[‘tag’]),
defaultCacheGet,
DELICIOUS_LIFETIME
)
);
}
The function appendDocument() parses an XML document received as a string, imports its root element
into the target document, and appends the result to the document
function appendDocument($document, $xml){
$fragment = new DOMDocument();
$fragment->loadXML($xml);
$importedFragment = $document->importNode($fragment->documentElement, true);
$document->documentElement->appendChild($importedFragment);
}
The complete document has the following structure:
<?xml version=”1.0”?>
<root>
<watches>
.
. The list of watches needed to create the Go menu is included here
.
</watches>
<watch>
.
. The definition of the current watch is included here
.
</watch>
<quote>
.
. The current stock quote is included here
.
</quote>
<rss version=”2.0”>
.
. The Yahoo finance news channel is included here
.
</rss>
<rdf:RDF>
.
. The del.icio.us channel is included here
.
</rdf:RDF>
</root>
31
Hello Web 2.0 World
04_087889 ch01.qxp 5/2/07 12:56 PM Page 31