ebook img

XML Bible PDF

1249 Pages·2001·9.539 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview XML Bible

4760-7 Cover 4/18/01 10:45 AM Page 1 If XML can do it, you can do it too . . . 100% 100% “The XML Bible provides complete coverage on all XML-related topics and will be an essential resource for any developer.” Now revised and expanded to cover the latest XML technologies and applications, this all-in-one tutorial and —Sean Rhody, Technical Editor, XML Journal reference shows you step by step how to put the power of XML to work in your Web pages. From document C O M P R E H E N S I V E ONE HUNDRED PERCENT type definitions and style sheets to XPointers, schemas, the Wireless Markup Language, XHTML and other COMPREHENSIVE AUTHORITATIVE Now updated! advanced tools and applications, XML expert Elliotte Rusty Harold gives you all the know-how and examples WHAT YOU NEED Covers XML you need to integrate XML with HTML, solve real-world development challenges, and create data-driven content. ONE HUNDRED PERCENT 1.0 second edition Inside, you’ll find complete coverage of XML XX Master XML • Create well-formed XML documents fundamentals including elements, • Place international characters in documents tags, attributes, • Validate documents against DTDs and schemas DTDs, and • Use entities to build large documents from smaller parts MM namespaces • Embed non-XML data in your documents Write Web • Format your documents with CSS and XSL style sheets pages in Harness the foreign • Connect documents with XLinks and XPointers languages power of CSS and and diverse XSL to format • Merge different XML vocabularies with namespaces scripts XML documents • Write metadata for Web pages using RDF LL • Harness XML for site design, vector graphics, Take XML to the and other real-world applications limit using XLinks, XPointers, Schemas, X ML X ML XML Resources on CD-ROM SVG, and XHTML • Code for all examples in the book, plus additional examples • XML authoring tools, including expat, XT, Xalan, 22nndd EEddiittiioonn Xerces, Batik, FOP, SAXON, HTML Tidy, and Mozilla • World Wide Web Consortium XML standards Publish XML Shareware programs are fully functional, free trial versions of copyrighted programs. If you like particular programs, register with their documents on authors for a nominal fee and receive licenses, enhanced versions, and technical support. Freeware programs are free, copyrighted the Web HAROLD games, applications, and utilities. You can copy them to as many PCs as you like—free—but they have no technical support. Bible w w w . h u n g r y m i n d s . c o m System Requirements: $49.99USA Reader Level: Shelving Category: Java 1.1 or later compatible platform such as Mac $74.99Canada Beginning to Advanced Web Development/XML XML code and OS 8.5 or later, Windows 95/98/Me/NT/2000, £39.99UK incl. VAT authoring tools Linux, or Solaris on ISBN 0-7645-4760-7 CD-ROM! BONUS *85555-AEHFHa ,!7IA7G4-fehgah!:p;o;t;T;T CD-ROM! 22nndd EEddiittiioonn Sample XML code XML authoring tools Elliotte Rusty Harold W3C standards Author of Java Network Programming XML Bible Second Edition Praise for Elliotte Rusty Harold’s XML Bible “Great book! I have about 10 XML books and this is by far the best.” —Edward Blair, Systems Analyst, AT&T “I recommend the XML Bible.I found it to be really helpful, as I am a beginner myself. It is easy to understand, which I found most useful since I am not a ‘tech- head.’” —Marius Holth Hanssen, Independent IT Consultant “I don’t know how to praise Elliotte Rusty Harold enough. When I read a technical book, I don’t expect to ENJOY it in the pure sense. Oh, I expect to ENJOY increasing my knowledge or to ENJOY the experience of successfully understanding a particu- larly poorly written passage. Your text is enjoyable in the pure sense. It is fun to read. I don’t have to force myself to pick up XML Bible— I jump for it because I know I will be finding something on each page to make me smile.” —Mike Maddux, Software Architect, Texas Department of Health “Just wanted to take a minute and send you a big thank you for writing XML Bible and Java Beans. Without those two books, my life would be so much harder!” —Ove “Lime” Lindström, Java Consultant, Enea Realtime AB XML Bible Second Edition Elliotte Rusty Harold Hungry Minds, Inc. New York, NY ✦Indianapolis, IN ✦Cleveland, OH XML Bible, Second Edition For general information on Hungry Minds’ products Published by and services please contact our Customer Care Hungry Minds, Inc. department within the U.S. at 800-762-2974, outside 909 Third Avenue the U.S. at 317-572-3993 or fax 317-572-4002. New York, NY 10022 For sales inquiries and reseller information, including www.hungryminds.com discounts, premium and bulk quantity sales, and Copyright © 2001 Hungry Minds, Inc. All rights foreign-language translations, please contact our reserved. No part of this book, including interior Customer Care department at 800-434-3422, fax design, cover design, and icons, may be reproduced 317-572-4002 or write to Hungry Minds, Inc., Attn: or transmitted in any form, by any means (electronic, Customer Care Department, 10475 Crosspoint photocopying, recording, or otherwise) without the Boulevard, Indianapolis, IN 46256. prior written permission of the publisher. For information on licensing foreign or domestic Library of Congress Control Number: 2001089303 rights, please contact our Sub-Rights Customer Care department at 212-884-5000. ISBN: 0-7645-4760-7 For information on using Hungry Minds’ products Printed in the United States of America and services in the classroom or for ordering 10 9 8 7 6 5 4 3 2 1 examination copies, please contact our Educational 2B/RX/QV/QR/IN Sales department at 800-434-2086 or fax 317-572-4005. Distributed in the United States For press review copies, author interviews, or by Hungry Minds, Inc. other publicity information, please contact our Distributed by CDG Books Canada Inc. for Canada; by Public Relations department at 317-572-3168 or Transworld Publishers Limited in the United fax 317-572-4168. Kingdom; by IDG Norge Books for Norway; by IDG For authorization to photocopy items for corporate, Sweden Books for Sweden; by IDG Books Australia personal, or educational use, please contact Publishing Corporation Pty. Ltd. for Australia and Copyright Clearance Center, 222 Rosewood Drive, New Zealand; by TransQuest Publishers Pte Ltd. for Danvers, MA 01923, or fax 978-750-4470. Singapore, Malaysia, Thailand, Indonesia, and Hong Kong; by Gotop Information Inc. for Taiwan; by ICG Muse, Inc. for Japan; by Intersoft for South Africa; by Eyrolles for France; by International Thomson Publishing for Germany, Austria, and Switzerland; by Distribuidora Cuspide for Argentina; by LR International for Brazil; by Galileo Libros for Chile; by Ediciones ZETA S.C.R. Ltda. for Peru; by WS Computer Publishing Corporation, Inc., for the Philippines; by Contemporanea de Ediciones for Venezuela; by Express Computer Distributors for the Caribbean and West Indies; by Micronesia Media Distributor, Inc. for Micronesia; by Chips Computadoras S.A. de C.V. for Mexico; by Editorial Norma de Panama S.A. for Panama; by American Bookshops for Finland. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND AUTHOR HAVE USED THEIR BEST EFFORTS IN PREPARING THIS BOOK. THE PUBLISHER AND AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS BOOK AND SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. THERE ARE NO WARRANTIES WHICH EXTEND BEYOND THE DESCRIPTIONS CONTAINED IN THIS PARAGRAPH. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN SALES MATERIALS. THE ACCURACY AND COMPLETENESS OF THE INFORMATION PROVIDED HEREIN AND THE OPINIONS STATED HEREIN ARE NOT GUARANTEED OR WARRANTED TO PRODUCE ANY PARTICULAR RESULTS, AND THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY INDIVIDUAL. NEITHER THE PUBLISHER NOR AUTHOR SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER DAMAGES. Netscape Communications Corporation has not authorized, sponsored, endorsed, or approved this publication and is not responsible for its content. Netscape and the Netscape Communications Corporate Logos, are trademarks and trade names of Netscape Communications Corporation. Trademarks:All trademarks are property of their respective owners. Hungry Minds, Inc. is not associated with any product or vendor mentioned in this book. is a trademark of Hungry Minds, Inc. Credits Acquisitions Editor Permissions Editor Grace Buechlein Laura Moss Project Editor Media Development Specialist Sharon Nash Gregory Stephens Technical Editor Media Development Coordinator Ken Cox Marisa Pearman Copy Editor Illustrators Richard H. Adin Gabriele McCann John Greenough Project Coordinator Nancee Reeves Proofreading and Indexing TECHBOOKS Production Services Graphics and Production Specialists Heather Pope, Jill Piscitelli, Cover Image Kathie Shutte Lawrance Huck Quality Control Technicians David Faust, Andy Hollandbeck, Angel Perez, Dwight Ramsey, Charles Spencer About the Author Elliotte Rusty Harold is an internationally respected writer, programmer, and edu- cator both on the Internet and off. He got his start writing FAQ lists for the Macintosh newsgroups on Usenet and has since branched out into books, Web sites, and newsletters. He’s an adjunct professor of computer science at Polytechnic University in Brooklyn, New York. His Cafe con Leche Web site at http://www.ibiblio.org/xml/has become one of the most popular indepen- dent XML sites on the Internet. Elliotte is originally from New Orleans, to which he returns periodically in search of a decent bowl of gumbo. However, he currently resides in the Prospect Heights neighborhood of Brooklyn with his wife, Beth, and cats, Charm (named after the quark) and Marjorie (named after his mother-in-law). When not writing books, he enjoys working on genealogy, mathematics, and quantum mechanics. His previous books include The Java Developer’s Resource, Java Network Programming, Java Secrets, JavaBeans, XML: Extensible Markup Language,and Java I/O. For Ma, a great grandmother Preface W elcome to the second edition of the XML Bible. When the first edition was published about two years ago, XML was a promising technology with a small but growing niche. In the last two years, it has absolutely exploded. XML no longer needs to be justified as a good idea. In fact, the question developers are ask- ing has changed from “Why XML?” to “Why not XML?” XML has become the data format of choice for fields as diverse as stock trading and graphic design. More new programs today are using XML than aren’t. A solid understanding of just what XML is and how to use it has become a sine qua nonfor the computer literate. The XML Bibleis your introduction to the exciting and fast-growing world of XML. With this book, you’ll learn how to write documents in XML and how to use style sheets to convert those documents into HTML so that legacy browsers can read them. You’ll alsolearn how to use document type definitions (DTDs) to describe and validate documents. You’ll experience a variety of XML applications in many domains, ranging from finance to vector graphics to genealogy. And you’ll learn how to take advantage of XML for your own unique projects, programs, and Web sites. Who You Are Unlike most other XML books on the market, the XML Biblediscusses XML from the perspective of a Web-page author, not from the perspective of a software developer. I don’t spend a lot of time discussing BNF grammars or parsing element trees. Instead, I show you how you can use XML and existing tools today to more effi- ciently produce attractive, exciting, easy-to-use, easy-to-maintain Web sites thatkeep your readers coming back for more. This book is aimed directly at Web-site developers. I assume you want to use XML to produce Web sites that are difficult to impossible to create with raw HTML. You’ll be amazed to discover that in conjunction with style sheets and a few free tools, XML enables you to do things that previously required either custom software cost- ing hundreds to thousands of dollars per developer, or extensive knowledge ofpro- gramming languages such as Perl. None of the software discussed in this book will cost youmore than a few minutes of download time. None of the tricks require any programming. What’s New in the Second Edition For the second edition, this book was rewritten from the ground up. While I retained the basic flavor and outline that proved so popular with the first edition, the writing has been tightened up throughout. I tried to address all common viii Preface complaints about the first edition. For instance, the largest examples are now smaller and easier to digest. Where mistakes or misstatements were found, they have been corrected. Most important, the text has been brought completely up to date with the state of the XML world in 2001. Many technologies that were rapidly changing, bleeding-edge tools in 1999 (XSLT, XSL-FO, XHTML, XLinks, XPointers, namespaces, etc.), have become the solid rocks on which future XML technologies are being built. Thus, it is now possible to offer much more comprehensive and final coverage of these, rather than the somewhat tentative first steps I took in the first edition. The world never stands still for long, however. In the two years since the first edi- tion appeared, new XML technologies have issued forth at a frightening pace. They are discussed here as well, though often with caveats that the details are still sub- ject to change. There are several completely new chapters covering many of these cutting-edge applications, including chapters on: ✦The Extensible Hypertext Markup Language (XHTML) ✦Scalable Vector Graphics (SVG) ✦Schemas ✦The Wireless Markup Language (WML) Even more important than the new chapters are the new sections woven into more familiar chapters. Although I made every effort to write more concisely in this edi- tion (My favorite reader comment about the first edition was, “It would seem to me that if you asked the author to write 10,000 words about the colour blue, he would be able to do it without breaking into a sweat”), we still ended up with a book 200 pages longer than before, and most of those 200 pages are new material scattered throughout the book. If you liked the first edition, I can only surmise that you’re going to like the second edition even more. It is in every way a better, more compre- hensive, more accurate book. If you didn’t like the first edition, I hope you’ll find the second more to your taste. What You Need to Know XML does build on top of the underlying infrastructure of the Internet and the Web. Consequently, I will assume you know how to ftp files, send e-mail, and load URLs into your Web browser of choice. I will also assume you have a reasonable knowl- edge of HTML atabout the level supported by Netscape 1.1. On the other hand, when I discuss newer aspects of HTML that are not yet in widespread use, such as Cascading Style Sheets, I discuss them in depth. To be more specific, in this book I assume that you can: ✦Write a basic HTML page, including links, images, and text, using a text editor. ✦Place that page on a Web server. Preface ix On the other hand, I do not assume that you: ✦Know SGML. In fact, this preface is almost the only place in the entire book you’ll see the word SGML used. XML is supposed to be simpler and more widespread than SGML. It can’t be that if you have to learn SGML first. ✦Are a programmer, whether of Java, Perl, C, or some other language. XML is amarkup language, not a programming language. You don’t need to be a pro- grammer to write XML documents. What You’ll Learn This book has one primary goal: to teach you to write XML documents for the Web. Fortunately, XML has a decidedly flat learning curve, much like HTML (and unlike SGML). As you learn a little you can do a little. As you learn a little more, you can do a little more. Thus the chapters in this book build steadily on one another. They are meant to be read in sequence. Along the way you’ll learn: ✦How to author XML documents and deliver them to readers. ✦How semantic tagging makes XML documents easier to maintain and develop than their HTML equivalents. ✦How to post XML documents on Web servers in a form everyone can read. ✦How to make sure your XML is well formed. ✦How to use international characters such as and Æ in your documents. ✦How to validate documents against DTDs and schemas. ✦How to use entities to build large documents from smaller parts. ✦How to describe data with attributes. ✦How to embed non-XML data in your documents. ✦How to merge different XML vocabularies with namespaces. ✦How to format your documents with CSS and XSL style sheets. ✦How to connect documents with XLinks and XPointers. ✦How to write metadata for Web pages using RDF. In the final section of this book, you’ll see several practical examples of XML being used for real-world applications, including: ✦Web site design ✦Schemas ✦Push ✦Vector graphics ✦Genealogy

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.