Professional XML Development with Apache Tools Xerces, Xalan, FOP, Cocoon, Axis, Xindice

Professional XML Development with Apache Tools Xerces, Xalan, FOP, Cocoon, Axis, Xindice

Professional XML Development with Apache Tools Xerces, Xalan, FOP, Cocoon, Axis, Xindice Theodore W. Leung Wiley Publishing, Inc. Professional XML Development with Apache Tools Xerces, Xalan, FOP, Cocoon, Axis, Xindice Professional XML Development with Apache Tools Xerces, Xalan, FOP, Cocoon, Axis, Xindice Theodore W. Leung Wiley Publishing, Inc. Professional XML Development with Apache Tools: Xerces, Xalan, FOP, Cocoon, Axis, Xindice Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2004 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada 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 Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8700. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4447, E-mail: [email protected]. Trademarks: Wiley, the Wiley Publishing logo, Wrox, the Wrox logo, the Wrox Programmer to Pro- grammer logo 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. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: WHILE THE PUBLISHER AND AUTHOR HAVE USED THEIR BEST EFFORTS IN PREPARING THIS BOOK, THEY MAKE NO REPRESENTA- TIONS 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. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN SALES MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR YOUR SITUA- TION. YOU SHOULD CONSULT WITH A PROFESSIONAL WHERE APPROPRIATE. 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, CON- SEQUENTIAL, OR OTHER DAMAGES. For general information on our other products and services or to obtain technical support, please con- tact 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. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Control Number: 2003115130 ISBN: 0-7645-4355-5 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 Credits Author Vice President & Executive Group Publisher Theodore W. Leung Richard Swadley Executive Editor Vice President & Executive Publisher Robert Elliott Robert Ipsen Production Editor Vice President and Publisher Vincent Kunkemueller Joseph B. Wikert Copy Editor Executive Editorial Director Tiffany Taylor Mary Bednarek Compositor Editorial Manager Gina Rexrode Kathryn A. Malm Book Producer Ryan Publishing Group, Inc. About the Author Theodore W. Leung Ted Leung is a Member of the Apache Software Foundation. He is a founding member of the Apache XML Project and served as the chairman of the XML Project Management Committee from March, 2001 to June, 2003. He is also the principal of Sauria Associates, LLC, a Pacific Northwest consultancy focused on high-impact software development. He has served companies such as F5 Networks, IBM, Enkubator, Apple Computer, and Taligent in roles spanning technical lead through chief technol- ogy officer. Ted holds a S.B in Mathematics from the Massachusetts Institute of Technology and a Sc.M. in Computer Science from Brown University. Ted has given a number of technical presentations at industry conferences, including Software Development West and ApacheCon. A full list of his speaking engagements is available at http://www.sauria.com/presentations.html. Acknowledgments Writing a book is a journey, and the journey begins well before the keys on the keyboard start click- ing. In my case, the journey to this book has led through a number of organizations, and I want to thank those that have helped me along the way. Without the Apache Software Foundation, this book—and more importantly, the software described in this book—would not exist. It has been my privilege to work with the contributors, committers and members of the ASF. I’d like to give special thanks to Dirk-Willem van Gulik, Stefano Mazzochi, Pierpaolo Fumagalli, Davanum Srinivas, and James Duncan Davidson. My involvement with the ASF would not have happened were it not for the hard work of the developers and management of the IBM Cupertino XML4J team: Mike Pogue, Andy Clark, Glenn Marcy, Ralf Pfieffer, Andy Heninger, Tom Watson, Eric Ye, Mike Weiner, Rajiv Jain, and Paul Buck. I’d also like to thank Rachel Reinitz, from IBM’s Software Services for Websphere, for starting me down the road of interacting with real people who were trying to get their jobs done using XML technologies. The actual act of writing a book cannot happen in a vacuum. Various people have provided much needed help or advice. My neighbor Kate deVeaux dropped everything to help me beat an eleventh hour deadline by taking the photograph that graces the cover of this book. My other neighbors Alex Torres and David Shenk provided valuable advice about how to handle various aspects of the book writing process. Apache is about community software development, performed across great distances via the won- der that is the Internet. But people also need a local, physical community, so I’d like to thank the members of our spiritual community, for their support, understanding, and prayers during this project, especially the Campbells, Woleslagles, Ziakins, Bests, and Larsens. Extra thanks to Larry Gonwick for physically standing in for me this summer. To Mom and Dad: Thank you for your love and all the years of prayers and hard labor. To Abigail, Michaela, and Elisabeth: Daddy is finally done with the book. We can go play now. To Julie, the love of my life, thank you for standing over me and guarding my time, hearing my frustrations, and enduring my absences. One of the many characterizations of the open source culture has been as a gift culture. Jesus Christ gave himself as a gift for the world. I want to thank him for the inspiration to be a gift giver. I hope that I will be able to follow his example. Contents Acknowledgments ix Introduction xvii Chapter 1: Xerces 1 Prerequisites 2 Well-Formedness 3 Validity 4 Entities 6 XML Parser APIs 6 SAX 8 DOM 13 Installing Xerces 15 Development Techniques 16 Xerces Configuration 16 Deferred DOM 20 Schema Handling 20 Grammar Caching 23 Entity Handling 29 Entity References 31 Serialization 34 XNI 38 Using the Samples 43 CyberNeko Tools for XNI 44 NekoHTML 44 ManekiNeko 44 NekoPull 45 Practical Usage 48 Common Problems 49 Applications 50 Chapter 2: Xalan 53 Prerequisites 53 XPath 53 XSLT 62 Installing and Configuring Xalan 69 Contents Development Techniques 70 TrAX 70 Xalan Specific Features 81 XSLTC 91 Xalan Extensions 97 Practical Usage 104 Applications 104 Chapter 3: FOP 113 Prerequisites 114 Basic XSL 115 Flows 115 List Blocks 116 Generating XSL with XSLT 117 Tables 119 Installing and Configuring FOP 123 Hyphenation 124 Development Techniques 125 Embedding 125 Using the Configuration Files and Options 127 SAX 129 DOM 131 XSLT 133 Validating XSL 135 Command-Line Usage 135 Ant Task 137 Fonts 138 Output 140 Graphics 143 FOP Extensions 145 Practical Usage 146 Applications 146 Chapter 4: Batik 155 Prerequisites 156 Static SVG 156 Dynamic SVG 164 Installing and Configuring Batik 169 Development Techniques 170 SVGGraphics2D 171 JSVGCanvas 183 xii Contents ImageTranscoding 187 SVG Scripting 191 Security 197 SVG Rasterizer 202 Command Line 202 SVG Browser 205 SVG Pretty-Printer 206 SVG Font Converter 207 Practical Usage 208 Applications 209 Rich Client User Interfaces 212 Chapter 5: Cocoon Concepts 213 Prerequisites 213 Concepts 214 Sitemap 214 Generators 223 Transformers 225 Serializers 229 Matchers 231 Selectors 233 Actions 234 Action Sets 236 Readers 236 Views 238 Resources 239 <pipeline> elements 239 Cocoon URIs 241 XSP 242 Sessions 253 Chapter 6: Cocoon Development 255 Installing and Configuring Cocoon 255 Configuring Cocoon 257 Development Techniques 258 Database Access 258 Simple Application 269 Practical Usage 283 Performance 283 Applications 284 xiii Contents Chapter 7: Xindice 285 Prerequisites 286 XML:DB 287 XUpdate 293 Installing and Configuring Xindice 299 Command-Line Tools 300 Runtime Environment 300 Adding to the Database 300 Retrieval 302 Deleting 303 Indexing 304 Other 306 Development Techniques 307 XML:DB API 307 Practical Usage 329 Applications 329 XMLServlet: Accessing Xindice 330 XSLTServletFilter 334 Deployment Descriptors 337 XSLT Stylesheets 338 A SAX-based Version 341 XPathResultHandler 346 Chapter 8: XML-RPC 349 Prerequisites 350 Concepts 350 XML Encoding RPCs 351 Using

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    30 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us