www.it-ebooks.info Praise for Essential XML Quick Reference “I think it is a wonderfully clear and concise summary of a great deal of key XML material. I expect it to find a well-thumbed home on my bookshelf.” —Mary Holstege, PhD, XML Architect, mathling.com, and W3C XML Schema Working Group Member “This book is a unique collection of reference material on the most relevant XML- related standards, which takes the important W3C recommendations and puts them all in context. Something that definitely needs to be on every XML devel- oper's desk!” —Alexander Falk, President and CEO of Altova, Inc. - The XML Spy Company “ Essential XML Quick Reference proves that Aaron Skonnard and Martin Gudgin can distill the essence of a very large, complicated topic like XML into easy to understand, bite-sized pieces. It’s an invaluable asset!” —Brad Wilson, Principal Software Architect, Quality Software Development “ Essential XML Quick Reference is one of the few printed references I would actu- ally buy.” —Don Box, Series Editor, The DevelopMentor Series “The full specification is quite verbose. Having the pocket reference makes life simpler when it comes to the ‘What was the name of that element again?’ or ‘What were the order of the parameters to that function?’ type questions. When I need a quick, concise, answer, I don’t want to have to thumb through hundreds of pages before getting the answer I need. This book is a very welcome, often relied upon, addition to my developer tool belt.” —Drew Marsh, Senior Architect, Mimeo.com, Inc. Skonnard.book Page i Monday, October 1, 2001 10:50 AM www.it-ebooks.info “I’ve read most of the documents regarding XML on the W3C site; the language definitions and standardization jargon makes them unapproachable to most devel- opers. This book makes the concepts make sense by giving concrete examples showing the different syntax variations. Essential XML Quick Reference is a com- prehensive reference book that will bridge a gap that hasn’t been filled. Almost anyone from basic to advanced skills will be able to use this book and I know I will keep it within arm’s reach at work. It’s a source that I will be able to go to in order to lookup subtle syntactic information that eludes me.” —Justin Burtch, Software Engineer, Integrated Data Systems Skonnard.book Page ii Monday, October 1, 2001 10:50 AM www.it-ebooks.info Essential XML Quick Reference Skonnard.book Page iii Monday, October 1, 2001 10:50 AM www.it-ebooks.info Don Box, Essential COM, 0-201-63446-5 Don Box, Aaron Skonnard, and John Lam, Essential XML: Beyond Markup, 0-201-70914-7 Keith Brown, Programming Windows Security, 0-201-60442-6 Matthew Curland, Advanced Visual Basic 6: Power Techniques for Everyday Programs, 0-201-70712-8 Doug Dunn, Java™ Rules, 0-201-70916-3 Tim Ewald, Transactional COM+L: Building Scalable Applications, 0-201-61594-0 Jon Flanders, ASP Internals, 0-201-61618-1 Martin Gudgin, Essential IDL: Interface Design for COM, 0-201-61595-9 Stuart Halloway, Component Development for the Java™ Platform, 0-201-75306-5 Joe Hummel, Ted Pattison, Justin Gehtland, Doug Turnure, and Brian A. Randell, Effective Visual Basic: How to Improve Your VB/COM+ Applications, 0-201-70476-5 Stanley B. Lippman, C# Primer: A Practical Approach, 0-201-72955-5 Everett N. McKay and Mike Woodring, Debugging Windows Programs: Strategies, Tools, and Techniques for Visual C++ Programmers, 0-201-70238-X Aaron Skonnard and Martin Gudgin, Essential XML Quick Reference: A Programmer's Reference to XML, XPath, XSLT, XML Schema, SOAP, and More, 0-201-74095-8 Addison-Wesley has joined forces with DevelopMentor, a premiere developer resources company, to produce a series of technical books written by developers for developers. DevelopMentor boasts a prestigious technical staff that includes some of the world’s best-known computer science professionals. “Works in The DevelopMentor Series are practical and informative sources on the tools and techniques for applying component-based technologies to real-world, large-scale distributed systems.” —Don Box Watch for future titles in The DevelopMentor Series. Titles in the Series: Skonnard.book Page iv Monday, October 1, 2001 10:50 AM www.it-ebooks.info Essential XML Quick Reference A Programmer’s Reference to XML, XPath, XSLT, XML Schema, SOAP, and More Aaron Skonnard Martin Gudgin Boston • San Francisco • New York • Toronto • Montreal London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City Skonnard.book Page v Monday, October 1, 2001 10:50 AM www.it-ebooks.info Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Addison-Wes- ley, Inc., was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The authors and publisher have taken care in the preparation of this book but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers discounts on this book when ordered in quantity for special sales. For more information, please contact Pearson Education Corporate Sales Division 201 W. 103 rd Street Indianapolis, IN 46290 (800) 428-5331 corpsales@pearsoned.com Visit AW on the Web: www.aw.com/cseng/ Library of Congress Cataloging-in-Publication Data Skonnard, Aaron Essential XML Quick Reference : a programmer’s reference to XML, XPath, XSLT, XML Schema, SOAP, and more / Aaron Skonnard, Martin Gudgin. p. cm. — (The DevelopMentor series) ISBN 0-201-74095-8 1. XML (Document markup language) I. Gudgin, Martin. II. Title. III. Series. QA76.76.H94 S59 2001 005.7'2—d21 2001034105 Copyright © 2002 by Pearson Education, Inc. All rights reserved. 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, or otherwise, without the prior consent of the publisher. Printed in the United States of America. Published simultaneously in Canada. 0-201-74095-8 Text printed on recycled paper 1 2 3 4 5 6 7 8 9 10—ML—0504030201 First printing, October 2001 Skonnard.book Page vi Monday, October 1, 2001 10:50 AM www.it-ebooks.info Aaron’s dedication: To my son Nathan, for the glimpse of heaven that you brought to my life Martin’s dedication: To Matthew and Sam, with love Skonnard.book Page vii Monday, October 1, 2001 10:50 AM www.it-ebooks.info Skonnard.book Page viii Monday, October 1, 2001 10:50 AM www.it-ebooks.info ix Chapter Contents 1 XML 1.0 and Namespaces 1 2 Document Type Definitions 15 3 XPath 1.0 35 4 XPointer, XInclude, and XML Base 69 5 XSL Transformations 1.0 85 6 SAX 2.0 159 7 DOM Level 2 193 8 XML Schema Datatypes 227 9 XML Schema Structures 287 10 SOAP 1.1 357 Skonnard.book Page ix Monday, October 1, 2001 10:50 AM www.it-ebooks.info [...]... XInclude XML Inclusions Infoset XML Information Set XLink XML Linking Language XPointer XML Pointer Language XSLT XSL Transformations www.it-ebooks.info Skonnard.book Page xxiii Monday, October 1, 2001 10:50 AM Preface This book is for anyone working with today’s mainstream XML technologies It was specifically designed to serve as a handy but thorough quick reference that answers the most common XML- related... Monday, October 1, 2001 10:50 AM xvi Essential XML Quick Reference 7.3 8 7.2.5 Document 7.2.6 DocumentFragment 7.2.7 DocumentType 7.2.8 DOMImplementation 7.2.9 Element 7.2.10 Entity 7.2.11 EntityReference 7.2.12 NamedNodeMap 7.2.13 Node 7.2.14 NodeList 7.2.15 Notation 7.2.16 ProcessingInstruction 7.2.17 Text References 199 205 205 206 207 211 212 212 215 223 225 225 226 226 XML Schema Datatypes 227 8.1 8.2... range-to 4.1.6.7 start-point 4.1.6.8 string-range XInclude 4.2.1 include XML Base 4.3.1 xml: base References 70 71 72 72 74 74 74 75 75 76 77 77 78 78 79 79 81 81 82 XSL Transformations 1.0 85 5.1 86 Introduction to XSLT programming www.it-ebooks.info Skonnard.book Page xiv Monday, October 1, 2001 10:50 AM xiv Essential XML Quick Reference 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 XSLT types and expressions Patterns... tagname, followed by the character sequence /> 1 www.it-ebooks.info Skonnard.book Page 2 Monday, October 1, 2001 8:57 AM 2 Essential XML Quick Reference XML does not define any element names; rather, it allows the designer of an XML document to choose what names will be used Element names in XML are case sensitive and must begin with a letter or an underscore (_) The initial character may be followed by any... generate-id 5.10.7 key 5.10.8 system-property 5.10.9 unparsed-entity-uri 5.11 References SAX 2.0 159 6.1 6.2 6 141 159 6.3 6.4 7 SAX UML quick reference SAX interfaces and classes 6.2.1 Attributes 6.2.2 ContentHandler 6.2.3 DTDHandler 6.2.4 EntityResolver 6.2.5 ErrorHandler 6.2.6 Locator 6.2.7 XMLFilter 6.2.8 XMLReader Features and properties References 143 144 147 148 148 149 150 152 153 154 155 155 156 157... Monday, October 1, 2001 10:50 AM www.it-ebooks.info Skonnard.book Page 1 Monday, October 1, 2001 8:57 AM XML Chapter 1 XML 1.0 and Namespaces XML 1.0 and Namespaces in XML provide a tag-based syntax for structuring data and applying markups to documents Documents that conform to XML 1.0 and Namespaces in XML specifications may be made up of a variety of syntactic constructs such as elements, namespace declarations,... www.it-ebooks.info 267 268 269 270 271 272 274 275 276 277 278 279 Skonnard.book Page xviii Monday, October 1, 2001 10:50 AM xviii Essential XML Quick Reference 8.4 8.5 9 Language constructs 8.4.1 simpleType 8.4.2 restriction 8.4.3 list 8.4.4 union References 280 281 282 283 284 286 XML Schema Structures 287 9.1 9.2 287 Schema element groupings Structures 9.2.1 all 9.2.2 annotation 9.2.3 any 9.2.4 anyAttribute... namespaces, and namespace declarations children www.it-ebooks.info Skonnard.book Page 3 Monday, October 1, 2001 8:57 AM 3 XML XML 1.0 and Namespaces Because XML allows designers to chose their own tagnames, it is possible... Monday, October 1, 2001 8:57 AM 4 Essential XML Quick Reference unqualified elements is the empty string "" If a default namespace declaration is in scope and an unqualified element is required, the default namespace declaration can be masked by providing a namespace declaration of the form xmlns='' on the element Examples Qualified and unqualified elements . Programmers, 0-201-70238-X Aaron Skonnard and Martin Gudgin, Essential XML Quick Reference: A Programmer's Reference to XML, XPath, XSLT, XML Schema, SOAP, and More, 0-201-74095-8 Addison-Wesley. iv Monday, October 1, 2001 10:50 AM www.it-ebooks.info Essential XML Quick Reference A Programmer’s Reference to XML, XPath, XSLT, XML Schema, SOAP, and More Aaron Skonnard Martin Gudgin . Congress Cataloging-in-Publication Data Skonnard, Aaron Essential XML Quick Reference : a programmer’s reference to XML, XPath, XSLT, XML Schema, SOAP, and more / Aaron Skonnard, Martin Gudgin. p.