Applied XML Solutions By Bent Marchal Publisher : Sams Publishing Pub Date : August 29, 2000 ISBN : 0-672-32054-1 Pages : 360 Slots :1 Applied XML Solutions presents a series of projects rather than a tutorial format The projects follow a natural progression from simple to complex Within each chapter, helpful sidebars highlight XML fundamentals necessary to understand the project in progress This will save readers' Table of time having to look to another source if they forget a key • Contents detail The last project incorporates techniques discussed throughout the book The author will illustrate alternative • Index solutions wherever appropriate Applied XML Solutions shows professional developers how to apply XML to a variety of real-world applications, including: XML as a scripting substitute, using RSS to syndicate content to multiple & non-traditional browsers such as WAP-enabled handheld devices, using XSLT to facilitate communication between incompatible systems, separating web content from web code, importing data from various file formats Applied XML Solutions By Bent Marchal Publisher : Sams Publishing Pub Date : August 29, 2000 ISBN : 0-672-32054-1 Table of Pages : 360 • Contents Slots :1 • Index Copyright About the Author Acknowledgments Tell Us What You Think! Introduction Why a Solution Book? Who Should Read This Book How to Read This Book Conventions Used in This Book Additional Resources Chapter 1 Lightweight Data Storage Why Lightweight Data Storage? Meeting the Catalog Viewer The XML Side Designing with Patterns Meeting the Builder Pattern Meeting the Visitor Pattern Building and Running the Project Additional Resources Chapter 2 Scripted Configuration Files Configuration Files Meeting Survex Building and Running the Project Benefits Additional Resources Chapter 3 Electronic Forms The Event Form Creating a Form with an Editor Running the Project Customizing the Behavior Writing Macros Advantages Additional Resources Chapter 4 Content Syndication Architecture Publishing Formats Styling on Demand The Style Sheets Building and Running the Project Additional Resources Chapter 5 Export to Any Format Meeting EDIFACT EDI Meets XML Breaking Down the Conversion Building the Formatter Writing the Style Sheet Building and Running the Project Additional Resources Chapter 6 Import from Any Format Parsing EDIFACT The EDIFACT Parser The Conversion Building and Running the Project Additional Resources Chapter 7 Write an e-Commerce Server XML Marketplaces A Commercial Transaction Architecture The Post Manager Sending the Invoice Building and Running the Project Additional Resources Chapter 8 Organize Teamwork Between Developers and Designers Servlets and Teams Using XSL in Servlets Building XslServlet Writing Pesticide Using XslServlet Building and Running the Project Playing with Style Sheets Additional Resources Chapter 9 Provide Up-to-the-Minute Information to Business Partners Architecture The SOAP Protocol A SOAP Library The Stock Server The Stock Client Building and Running the Project Additional Resources Chapter 10 Where to Now XML As a File Format Publishing Versus Data Flexible, Generic Tools e-Commerce Appendix A XML Reference XML Elements XML Document Entities Namespaces Appendix B Parser Reference XMLReader ContentHandler DTDHandler ErrorHandler EntityResolver InputSource Attributes Locator Exceptions XMLFilter XMLReaderFactory DefaultHandler Appendix C XSLT Reference Style Sheet Templates Template Content XPath Combining Style Sheets Parameters and Variables Tests and Conditions Functions Copying Extensions Index Copyright Copyright © 2000 by Sams All rights reserved No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher No patent liability is assumed with respect to the use of the information contained herein Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions Nor is any liability assumed for damages resulting from the use of the information contained herein Library of Congress Catalog Card Number: 00-104353 Printed in the United States of America First Printing: September 2000 02 01 00 4 3 2 1 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized Sams cannot attest to the accuracy of this information Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied The information provided is on an "as is" basis The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the CD or programs accompanying it Dedication To Pascale About the Author Bent Marchal runs the consulting company Pineapplesoft, which specializes in Internet applications, particularly e-commerce, XML, and Java He has worked with major players in Internet development, such as Netscape and EarthWeb, and is a regular contributor to Gamelan and other Internet publications In 1997, he co-founded the XML/EDI Group, a think tank that promotes the use of XML in e-commerce applications Bent frequently leads corporate training on XML and other Internet technologies Bent also publishes a free email magazine, Pineapplesoft Link Each month it provides technologies, trends, and facts of interest to Web developers You can subscribe at www.marchal.com Acknowledgments I want to thank the readers of XML by Example, Pineapplesoft Link, and my technical articles You are the motivation and inspiration to explore new topics I am particularly grateful to readers who emailed me or otherwise commented on my work Your opinions are always instructive Tell Us What You Think! As the reader of this book, you are our most important critic and commentator We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way As an Associate Publisher for Sams, I welcome your comments You can fax, email, or write me directly to let me know what you did or didn't like about this bookas well as what we can do to make our books stronger Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message When you write, please be sure to include this book's title and author as well as your name and phone or fax number I will carefully review your comments and share them with the author and editors who worked on the book Fax: Email: Mail: 317-581-4770 consumer@mcp.com Associate Publisher Sams 201 West 103rd Street Indianapolis, IN 46290 USA [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] UML 2nd 3rd UML (Unified Modeling Language) UML model UN/EDIFACT [See EDIFACT] UnexpectedTokenException class UnexpectedTokenException.java 2nd UNH segment Unified Modeling Language [See UML] United Nations Standard Messages [See UNSMs] units em UNS segment UNSMs UNT segment updating change list inventory levels 2nd user interface 2nd 3rd XMetaL URIs URLs converting to XML files 2nd extracting style sheets 2nd alternatives 2nd user interface updating 2nd 3rd [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] valid documents validating forms 2nd 3rd validation errors turning on/off variables 2nd plus state VB Systems Web site version attribute versioning VideoProduct class View menu commands Plain Text Toolbars viewers XSLFO viewing invoices visitConcreeteElement() method Visitor class visitor classes replacing Visitor object 2nd visitor pattern 2nd 3rd 4th 5th advantages 2nd applying 2nd 3rd 4th 5th 6th 7th 8th Visual Parse++ compiler-compiler VisualProduct objects 2nd 3rd Vivid Creations Web site vocabularies 2nd 3rd developing 2nd 3rd legacy formats Web sites XML creating 2nd 3rd 4th 5th void characters(char[] ch,int start,int length) event void endDocument() event void endElement(String namespaceURI,String localName, String qName event void endPrefixMapping(String prefix) event void error(SAXPar [See xception exception) method] void fatalError(SAXPar [See xception exception) method] void ignorableWhitespace(char[] ch,int start,int length) event void notationDecl(String name, String publicId,String systemId) event void parse(InputSource input) method void parse(String systemId) method void processingInstruction (String target, String data) event void setByteStream(InputStream byteStream) method void setCharacterStream(Reader characterStream) method void setContentHandler(ContentHandler handler) method void setDocumentLocator(Locator locator) event void setDTDHandler(DTDHandler handler) method void setEncoding(String encoding) method void setEntityResolver(EntityResolver resolver) void setErrorHandler(ErrorHandler handler) method void setFeature(String name, boolean value) method void setParent(XMLReader parent) method void setProperty(String name,Object value) method void setPublicId(String publicId) method void setSystemId(String systemId) method void skippedEntity(String name) event void startDocument() event void startElement(String namespaceURI,String localName,String qName, Attributes atts event void startPrefixMapping(String prefix,String uri) event void unparsedEntityDecl(String name,String publicId,String systemId, String notationName) event void warning(SAXPar [See xception exception) method] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] W3C 2nd W3C (World Wide Web Consortium) W3C Web site 2nd WAP browsers 2nd WAP Forum Web site WAP gateways 2nd WAP-enabled telephones WAPman 2nd WAPman Web site 2nd WDDX WDDX Web site Web pages authoring 2nd RSS editing 2nd publishing RSS Web servers adding servlet support 2nd Jetty 2nd 3rd 4th Web sites 4thpass Abraxas 2nd ANTLR Apache 2nd 3rd 4th Ariba Axolot Bolero CommerceOne DevelopMentor DocBook 2nd ebXML EDIFACT standard EnterpriseSoft Ericsson excelon Corporation eXML GNU IBM XSL Editor InDelv iPlanet JPython JRun libxml-perl Mercator Mort Bay Mozilla My Userland NeonSoft Nokia 2nd Open eBook Forum providing information to retailers 2nd 3rd 4th PureEdge Rocket eBook RosettaNet Sand-Stone SAX SAX for Python SAX2 parser reference Seagate Software SOAP for Java SoftQuad translating VB Systems Vivid Creations W3C 2nd WAP Forum WAPman 2nd WDDX WebMethods 2nd WinWAP XMetal XML vocabularies XML-RPC XML/EDI XML/EDI Group XMLEDI XMLTree XSLT standard WebMethods Web site 2nd well-formed documents WIDL WinWAP WinWAP Web site Wirth, Niklaus Compiler Construction [ital] WML 2nd 3rd 4th cards 2nd navigating titles toc comparing to HTML 2nd WML style sheets 2nd World Wide Web Consortium [See W3C] writeHTML() method 2nd writeRawXML() method writeRequest() method writeResponse() method 2nd writeStyledXml() method 2nd 3rd 4th writeTo() method writing Description objects 2nd EDIFACT parser 2nd 3rd 4th 5th 6th 7th 8th 9th faults formatters macros 2nd Pesticide stock clients 2nd 3rd style sheets 2nd 3rd 4th 5th tokenizers EDIFACT parser 2nd 3rd 4th 5th [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] Xalan 2nd 3rd 4th 5th downloading 2nd Xalan extensions 2nd Xalan XSL processors Xerces downloading 2nd Xerces parser XHTML 2nd 3rd XMetaL 2nd behavior customizing 2nd comparing to XML Notepad installing 2nd 3rd loading XML models in 2nd updating XMetaL Web site XML 2nd 3rd advantages 2nd 3rd 4th comparing to EDI 2nd 3rd comparing to HTML e-commerce 2nd 3rd faults writing orders comparing to EDIFACT orders 2nd syntax 2nd 3rd vocabularies 2nd 3rd developing 2nd 3rd legacy formats XML (eXtensible Markup Language) XML attributes generating 2nd XML code displaying editing XML databases XML documents 2nd converting additional resources converting EDI documents to 2nd converting to EDIFACT documents 2nd 3rd 4th document type declarations 2nd root elements XML declarations 2nd XML editor XML editors advantages 2nd XMetaL [See XMetaL] XML elements generating 2nd 3rd XML files 2nd 3rd converting URLs to 2nd XML filters XML marketplaces 2nd 3rd XML modeling 2nd tags 2nd XML models creating 2nd 3rd 4th loading in XMetaL 2nd XML Notepad comparing to XMetaL XML parser XML Stylesheet Language [See XSL] XML tags 2nd XML vocabularies creating 2nd 3rd 4th 5th XML Web sites vocabularies XML-based scripting language additional resources Flow WIDL XSL XML-RPC 2nd 3rd XML-RPC Web site XML/EDI Group XML/EDI Group Web site 2nd xml2edi command XML2Edifact class XMLDirector class 2nd 3rd 4th XMLEDI Web site XMLFilter 2nd XMLFilterImpl XMLReader 2nd 3rd 4th XMLReader getParent() method XMLReaderFactory 2nd XMLTree Web site XMLVisitor class XMLWriter class 2nd XPath 2nd 3rd axes 2nd 3rd functions 2nd XPaths xsi( )type attribute XSL 2nd XSL (XML Stylesheet Language) XSL editor XSL formatter 2nd XSL processor calling XSL processors speed 2nd XSL servlets XSL style sheets 2nd 3rd XSL transformation performing XSL Transformation [See XSLT] xsl(colon)apply-imports xsl(colon)attribute xsl(colon)call-template xsl(colon)choose xsl(colon)copy 2nd xsl(colon)element xsl(colon)for-each xsl(colon)if xsl(colon)include 2nd xsl(colon)namespace-alias xsl(colon)output xsl(colon)stylesheet 2nd xsl(colon)template 2nd xsl(colon)text xsl(colon)value-of XSL [See also XSLT] XSLFO 2nd XSLFO viewers XslServlet class 2nd 3rd 4th 5th XslServlet library XslServletLiaison class 2nd XslServletLiaisonImpl class 2nd 3rd 4th 5th 6th XSLT 2nd 3rd 4th 5th 6th adantages 2nd advantages 2nd extensions 2nd functions 2nd templates 2nd 3rd 4th attributes 2nd input-directed 2nd named 2nd output-controlled 2nd XSLT (XSL Transformation) [See also XSL] XSLT editors XSLT extension XSLT processor 2nd XSLT standard Web site XSLT style sheet 2nd 3rd 4th 5th 6th output 2nd XslWriter class [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] YACC compiler-compiler [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z] zooming in code lists data elements ... Applied XML Solutions By Bent Marchal Publisher : Sams Publishing Pub Date : August 29, 2000 ISBN : 0-672-32054-1 Table of Pages : 360 • Contents... ideas and new solutions to problems Applied XML Solutions will be particularly valuable if you are currently working on XML projects or if you will soon join such a team It provides sample solutions to problems and plenty of code you can reuse, teaches... If you are not actively involved in an XML project, Applied XML Solutions will be a source of inspiration for the future As you read through the solutions, I am sure you will find several examples that would work well for you Applied XML Solutions assumes that you know the XML syntax, how an