Apress :: The Expert's VoiceWelcome to Apress.com. Books for Professionals, by Professionals(TM)...with what the
professional needs to know(TM)2007-07-25T12:57:02ZApress, Inc.support@apress.comhttp://apress.com/Excel 2007: Beyond the Manualhttp://www.apress.com/book/bookDisplay.html?bID=102322007-07-25T12:57:02Z2007-03<p><i>Excel 2007: Beyond the Manual</i> will introduce those who are already familiar with Excel basics to more advanced features, like consolidation, what-if analysis, PivotTables, sorting and filtering, and some commonly used functions. You'll learn how to maximize your efficiency at producing professional-looking spreadsheets and charts and become competent at analyzing data using a variety of tools. The book includes practical examples to illustrate advanced features.</p>Word 2007: Beyond the Manualhttp://www.apress.com/book/bookDisplay.html?bID=102492007-07-25T12:57:10Z2007-03-01<p><i>Word 2007: Beyond the Manual</i> focuses on new features of Word 2007 as well as older features that were once less accessible than they are now. This book also makes a point to include examples of practical applications for all the new features. The book assumes familiarity with Word 2003 or earlier versions, so you can focus on becoming a confident 2007 user.</p>
EOT;
# instantiate a simpleXML object based on the $feed XML
$xml = simplexml_load_string($feed);
# access the title and subtitle elements
print "title: {$xml->title}\n";
print "subtitle: {$xml->subtitle}\n";
# loop through the two link elements, printing all the attributes for each link.
print "processing links\n";
foreach ($xml->link as $link) {
print "attribute:\t";
foreach ($link->attributes() as $a => $b) {
print "{$a}=>{$b}\t";
}
print "\n";
}
print "author: {$xml->author->name}\n";
# let's check out the namespace situation
$ns_array = $xml->getDocNamespaces(true);
# display the namespaces that are in the document
print "namespaces in the document\n";
foreach ($ns_array as $ns_prefix=>$ns_uri) {
print "namespace: ${ns_prefix}->${ns_uri}\n";
}
print "\n";
# loop over all the entry elements
foreach ($xml->entry as $entry) {
print "entry has the following elements in the global namespace: \t";
// won't be able to access tags that aren't in the global namespace.
foreach ($entry->children() as $child) {
print $child->getName(). " ";
}
print "\n";
print "entry title: {$entry->title}\t link: {$entry->link["href"]}\n";
// show how to use xpath to get date
// note dc is registered already to $xml.
$date = $entry->xpath("./dc:date");
print "date (via XPath): {$date[0]}\n";
// use children() to get at date
$date1 = $entry->children("http://purl.org/dc/elements/1.1/");
print "date (from children()): {$date[0]}\n";
}
# add to feed -- adding the element will work but the tag is in the
# wrong place to make a valid Atom feed.
# It is supposed to go before the entry elements
$category = $xml->addChild("category");
$category->addAttribute('term','books');
# output the XML to show that category has been added.
$newxmlstring = $xml->asXML();
print "new xml (with category tag): \n$newxmlstring\n";
?>