01_087889 ffirs.qxp 10/19/06 3:55 PM Page i Professional Web 2.0 Programming 01_087889 ffirs.qxp 10/19/06 3:55 PM Page ii 01_087889 ffirs.qxp 10/19/06 3:55 PM Page iii Professional Web 2.0 Programming Eric van der Vlist, Alessandro Vernet, Erik Bruchez, Joe Fawcett, and Danny Ayers 01_087889 ffirs.qxp 10/19/06 3:55 PM Page iv Professional Web 2.0 Programming Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2007 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN-13: 978-0-470-08788-6 ISBN-10: 0-470-08788-9 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1MA/QX/RR/QW/IN No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Cen- ter, 222 Rosewood Drive, Danvers, MA01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indi- anapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACYOR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLYDISCLAIM ALLWARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR APARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONALMATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAYNOT BE SUITABLE FOR EVERYSITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONALASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALLBE LIABLE FOR DAMAGES ARISING HERE- FROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR APOTENTIALSOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAYPROVIDE OR RECOMMENDATIONS IT MAYMAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAP- PEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002. Library of Congress Cataloging-in-Publication Data is available from the publisher. Trademarks:Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. 01_087889 ffirs.qxp 10/19/06 3:55 PM Page v To my wife Catherine and children Deborah, David, Samuel, and Sarah for the high tribute they have paid to this book through my lack of availability! —E. van der V. Dedicated to my wonderful wife, Yue. You have changed my life for the best, and I love you more than I can say. —A.V. To Carol, for her patience and support during those working evenings and weekends. —E.B. To my wife Gillian and my children, Persephone and Xavier, who make it all worthwhile. —J.F. I dedicate my contribution to this book to our dog Basil, who missed out on a lot of walks while I worked. —D.A. For Virgil Matheson —M.D. 01_087889 ffirs.qxp 10/19/06 3:55 PM Page vi About the Authors Eric van der Vlistis an independent consultant and trainer. His domain of expertise includes Web devel- opment and XMLtechnologies. He is the creator and main editor of XMLfr.org, the main site dedicated to XMLtechnologies in French, the author of the O’Reilly books XMLSchemaand RELAX NG, and a member or the ISO DSDL(http://dsdl.org) working group, which focuses on XMLschema lan- guages. He is based in Paris and you can reach him by mail ([email protected]) or meet him at one of the many conferences where he presents his projects. Alessandro Vernethas been involved with web and XMLtechnologies from day one. Prior to co-founding Orbeon, he worked at Symantec Corporation as part of the VisualCafe team, working on the next-generation RAD for web applications. He is the co-author of The Best of Java, received the 1998 Logitech Award for his master’s thesis on Jaskell, and is one of the architects of the open source Orbeon PresentationServer (OPS) project. His current interests lie in XMLtechnologies and web applications. He recently implemented an XForms engine using Ajax/JavaScript, co-authored the XMLPipeline Language specification published by the W3C, and is active in two W3C Working Groups: the XForms and XMLProcessing Model Working Groups. He holds an MS/CS from the Swiss Institute of Technology (EPFL) in Lausanne, Switzerland. Erik Bruchezhas extensive experience in the software industry as a software architect and consultant. As a former employee of Symantec Corporation, he contributed to the VisualCafe for Java product line. In 1999, he co-founded Orbeon, Inc. (www.orbeon.com), where he is now an architect of Orbeon PresentationServer (OPS), an open source web platform for form-based applications that builds on tech- nologies such as XForms and Ajax. Erik participates in the W3C’s XForms and XMLProcessing Model working groups. He is the author of articles about web applications and XMLtechnologies and has been a speaker at conferences such as JavaOne, ObjectWebCon, and XTech. Erik holds an MS/CS degree from the Swiss Institute of Technology (EPFL) in Lausanne, Switzerland. He spends most of his time between Switzerland and California and can be reached by email at [email protected]. Joe Fawcettstarted programming in the seventies and briefly worked in IT after leaving full-time educa- tion. He then pursued a more checkered career before returning to software development in 1994. In 2003 he was awarded the title of Microsoft Most Valuable Professional in XMLfor community contribu- tions and technical expertise. He currently works in London as senior developer for FTC Kaplan Ltd, a leading international provider of accountancy and business training. Danny Ayersis a freelance developer, technical author, and consultant specializing in cutting-edge Web technologies. His motivation is the belief that with a little encouragement, the Web can be significantly more useful and interesting than it is now. He’s been a blogger for some five years (http://danny ayers.com), with a tendency to post material relating to the Semantic Web or cat photos. Technical Editor Micah Dubinkois an experienced software architect and writer working for the MobilePlatform group at Yahoo! Inc. He has been programming since the third grade—at the time on a computer with only 2K of memory. Micah served as an editor and author of the W3C XForms specifica- tion, publishing a book in print and online, and eventually being awarded the InfoWorld Innovators 2004 award for his effort. Since then, he has contributed to and edited numerous Web 2.0 books and articles. His blog is at http://dubinko.info/blog/. Micah lives with his wife and two daughters inSilicon Valley. 01_087889 ffirs.qxp 10/19/06 3:55 PM Page vii Credits SeniorAcquisitions Editor Project Coordinators Jim Minatel Ryan Steffen Jennifer Theriot Development Editor Sara Shlaer Graphics and Production Specialists Carrie A. Foster Technical Editor Denny Hager Micah Dubinko Jennifer Mayberry Barbara Moore Production Editor Heather Ryan Felicia Robinson Alicia B. South Copy Editor Quality Control Technician Michael Koch John Greenough Editorial Manager Proofreading Mary Beth Wakefield Techbooks Production Manager Indexing Tim Tate Infodex Indexing Services, Inc. Vice President and Executive Group Publisher Richard Swadley Vice President and Executive Publisher Joseph B. Wikert 01_087889 ffirs.qxp 10/19/06 3:55 PM Page viii 02_087889 ftoc.qxp 10/19/06 3:56 PM Page ix Contents Foreword xvii Acknowledgments xix Introduction xxi Chapter 1: Hello Web 2.0 World 1 Introducing BuzzWatch 1 Charting the Landscape 4 Exploring Behind the Scene 6 Making BuzzWatch a Better Web Citizen 24 Making BuzzWatch More Maintainable 28 Applying the Final Touch 33 Conclusion 35 Chapter 2: Page Presentation 37 Creating Clean and Simple Pages 37 Producing Valid HTML 38 Using Cascading Style Sheets 40 Choosing Appropriate Elements 41 From HTML to XHTML 42 XHTML 1.0 43 XHTML 1.1 43 Why Use XHTML? 44 Differences from HTML 45 The Document Object Model 47 DOM Levels 49 DOM API Overview 49 DOM API Reference 51 Cascading Style Sheets 51 Rounded Corners 52 Tabs 54 Tools 55 The DOM Inspector for Firefox 55 The Web Developer Toolbar for Firefox 57 The Internet Explorer Developer Toolbar 58 DevBoi for Firefox 59 Summary 60
Description: