Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

New Perspectives on XML, Comprehensive
Nội dung xem thử
Mô tả chi tiết
New Perspectives on XML, 3rd Edition, Comprehensive
Textbook Reviewers
We are extremely grateful to the New Perspectives on XML, 3rd Edition, Comprehensive textbook reviewers listed
below, and would like to take this opportunity to acknowledge them for their contributions in the development
of this text. Their timely reviews, informed feedback, and excellent suggestions were tremendously valuable and
helped us to produce an outstanding text that will meet the needs of all our New Perspectives instructors and
students. Our sincere thanks to all!
Textbook Reviewers
David Doering, St. Louis Community College
Ravinder Kang, Highline Community College
Diana Kokoska, University of Maine at Augusta
Barbara Rader, University of Maryland
Sheryl Schoenacher, Farmingdale State College
Dave Sciuto, University of Massachusetts—Lowell
John Whitney, Fox Valley Technical College
Dawn Wick, Southwestern Community College
“The third edition of New Perspectives on XML takes a practical approach to teaching the foundations of XML. It
provides real-world scenarios that allow students to work hands-on, applying XML concepts. The structure of each
chapter affords the student, whether online or in the classroom, a variety of learning activities designed to support
all learning styles. I have successfully used the New Perspectives on XML text for many years, teaching thousands of
students the practical purposes for XML. Success in using the text is measurable in the number of ‘Aha!’ moments
most students have thanks to clearly defined and explained concepts, numerous practical examples, and tutorials that
challenge their working knowledge of XML. This newest edition takes vital steps toward transforming the student of
XML into a working practitioner.”
—Dave Sciuto,
University of Massachusetts—Lowell
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Australia • Brazil • Mexico • Singapore • United Kingdom • United States
Patrick Carey
Sasha Vodnik
New Perspectives on
XML
3rd Edition
COMPREHENSIVE
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
This is an electronic version of the print textbook. Due to electronic rights restrictions, some third party content may be suppressed. Editorial
review has deemed that any suppressed content does not materially affect the overall learning experience. The publisher reserves the right to
remove content from this title at any time if subsequent rights restrictions require it. For valuable information on pricing, previous
editions, changes to current editions, and alternate formats, please visit www.cengage.com/highered to search by
ISBN#, author, title, or keyword for materials in your areas of interest.
Important Notice: Media content referenced within the product description or the product text may not be available in the eBook version.
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
For product information and technology assistance, contact us at
Cengage Learning Customer & Sales Support, 1-800-354-9706
For permission to use material from this text or product, submit all
requests online at www.cengage.com/permissions
Further permissions questions can be emailed to
New Perspectives on XML
3rd Edition, Comprehensive
Product Director: Kathleen McMahon
Senior Director of Development: Marah Bellegarde
Senior Product Manager: Jim Gish
Product Development Manager: Leigh Hefferon
Senior Content Developer: Kathy Finnegan
Marketing Director: Michele McTighe
Senior Marketing Manager: Eric La Scolla
Developmental Editor: Pam Conrad
Composition: GEX Publishing Services
Art Director: Marissa Falco
Text Designer: Althea Chen
Cover Designer: GEX Publishing Services
Cover Art: ©Tarek El Sombati/E+/Getty Images
Copyeditor: GEX Publishing Services
Proofreader: Vicki Zimmer
Indexer: Richard Carlson
Library of Congress Control Number: 2014952799
ISBN: 978-1-285-07582-2
Cengage Learning
20 Channel Center Street
Boston, MA 02210
USA
Cengage Learning is a leading provider of customized learning solutions
with office locations around the globe, including Singapore, the United
Kingdom, Australia, Mexico, Brazil, and Japan. Locate your local office at:
www.cengage.com/global
Cengage Learning products are represented in Canada by
Nelson Education, Ltd.
For your course and learning solutions, visit www.cengage.com
Purchase any of our products at your local college store or at our
preferred online store www.cengagebrain.com
Some of the product names and company names used in this book have been used for
identification purposes only and may be trademarks or registered trademarks of their
respective manufacturers and sellers.
Microsoft and the Office logo are either registered trademarks or trademarks of Microsoft
Corporation in the United States and/or other countries. Cengage Learning is an independent entity from the Microsoft Corporation, and not affiliated with Microsoft in any manner.
Disclaimer: Any fictional data related to persons or companies or URLs used throughout
this book is intended for instructional purposes only. At the time this book was printed,
any such data was fictional and not belonging to any real persons or companies.
© 2015 Cengage Learning
WCN: 02-200-203
ALL RIGHTS RESERVED. No part of this work covered by the copyright
herein may be reproduced, transmitted, stored or used in any form or by
any means graphic, electronic, or mechanical, including but not limited to
photocopying, recording, scanning, digitizing, taping, Web distribution,
information networks, or information storage and retrieval systems, except
as permitted under Section 107 or 108 of the 1976 United States Copyright
Act, without the prior written permission of the publisher.
Printed in the United States of America
Print Number: 01
ProSkills Icons © 2014 Cengage Learning.
Print Year: 2014
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
“With the clear
instructions in this text,
students know exactly
what code to write and
where to place it. The
exercises enable students
to apply what they’ve
learned using realistic
business scenarios. I
would recommend this
text to anyone teaching
XML or learning it on their
own.”
—Dawn Wick
Southwestern Community
College
www.cengage.com/series/newperspectives
The New Perspectives Series’ critical-thinking, problem-solving approach is the ideal way
to prepare students to transcend point-and-click skills and take advantage of all that XML
has to offer.
In developing the New Perspectives Series, our goal was to create books that give students
the software concepts and practical skills they need to succeed beyond the classroom.
We’ve updated our proven case-based pedagogy with more practical content to make
learning skills more meaningful to students. With the New Perspectives Series, students
understand why they are learning what they are learning, and are fully prepared to apply
their skills to real-life situations.
About This Book
This book provides complete coverage of XML including the following:
• Using XSLT to transform XML data into HTML format
• Creating custom reports using XSLT 2.0 and XPath 2.0
• Designing database queries using XQuery
New for this edition!
• Each session begins with a Visual Overview, which includes colorful, enlarged figures with numerous callouts and key term definitions, giving students a comprehensive preview of the topics covered in the session, as well as a handy study guide.
• New ProSkills boxes provide guidance for how to use the software in real-world,
professional situations, and related ProSkills exercises integrate the technology skills
students learn with one or more of the following soft skills: decision making, problem solving, teamwork, verbal communication, and written communication.
• Important steps are highlighted in yellow with attached margin notes to help students
pay close attention to completing the steps correctly and avoid time-consuming rework.
System Requirements
This book assumes that students have access to a current browser that supports the viewing
of XML files and XML files transformed using XSLT. Current versions of the major browsers
support these features of XML with the exception of Google Chrome, which does not support
XML documents stored locally. The screenshots of web pages in this book were produced
using Internet Explorer 10 running on Windows 7 Professional (64-bit) and Internet Explorer 11
running on Windows 8.1 (64-bit), unless otherwise noted. Students who intend to validate
their XML documents in Tutorials 2 through 4 should have access to an XML validating parser,
such as Exchanger XML Editor, or to an online validation service. Students who intend to transform XML documents using XSLT should have access to an XSLT processor such as Exchanger,
XMLSpy or Saxon. The transformations performed in Tutorials 5 through 8 were done using
Saxon-HE (home edition) available free for Java or .NET at http://saxon.sourceforge.net.
Students who perform XQuery data queries in Tutorial 9 should have access to an XQuery processor. Such queries were performed in Tutorial 9 using Saxon-HE. Students who are using
processors other than Saxon should consult their processor’s documentation for specific installation and operation instructions.
Preface
iii
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
www.cengage.com/series/newperspectives
KEY STE P
Visual Overview
iv New Perspectives Series
The New Perspectives Approach
Context
Each tutorial begins with a problem presented in a “real-world” case that is meaningful to
students. The case sets the scene to help students understand what they will do in the tutorial.
Hands-on Approach
Each tutorial is divided into manageable sessions that combine reading and hands-on, step-by-step
work. Colorful screenshots help guide students through the steps. Trouble? tips anticipate common mistakes or problems to help students stay on track and continue with the tutorial.
Visual Overviews
New for this edition! Each session begins with a Visual Overview, a new two-page spread that
includes colorful, enlarged figures with numerous callouts and key term definitions, giving
students a comprehensive preview of the topics covered in the session, as well as a handy
study guide.
ProSkills Boxes and Exercises
New for this edition! ProSkills boxes provide guidance for how to use the software in realworld, professional situations, and related ProSkills exercises integrate the technology skills
students learn with one or more of the following soft skills: decision making, problem solving,
teamwork, verbal communication, and written communication.
Key Steps
New for this edition! Important steps are highlighted in yellow with attached margin notes to
help students pay close attention to completing the steps correctly and avoid time-consuming
rework.
InSight Boxes
InSight boxes offer expert advice and best practices to help students achieve a deeper understanding of the concepts behind the software features and skills.
Margin Tips
Margin Tips provide helpful hints and shortcuts for more efficient use of the software. The Tips
appear in the margin at key points throughout each tutorial, giving students extra information
when and where they need it.
Assessment
Retention is a key component to learning. At the end of each session, a series of Quick Check
questions helps students test their understanding of the material before moving on. Engaging
end-of-tutorial Review Assignments and Case Problems have always been a hallmark feature of
the New Perspectives Series. Colorful bars and brief descriptions accompany the exercises, making it easy to understand both the goal and level of challenge a particular assignment holds.
Reference
Within each tutorial, Reference boxes appear before a set of steps to provide a succinct summary and preview of how to perform a task. In addition, each book includes a combination
Glossary/Index to promote easy reference of material.
apply
review
reference
insight
ProSkills
“New Perspectives texts
provide up-to-date,
real-world application of
content, making book
selection easy. The
step-by-step, hands-on
approach teaches
students concepts they
can apply immediately.”
—John Taylor
Southeastern Technical
College
Glossary/Index
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Level Color Scheme
www.cengage.com/series/newperspectives
XML 3rd Edition, Comprehensive v
Our Complete System of Instruction
Coverage To Meet Your Needs
Whether you’re looking for just a small amount of coverage or enough to fill a semester-long
class, we can provide you with a textbook that meets your needs.
• Brief books typically cover the essential skills in just 2 to 4 tutorials.
• Introductory books build and expand on those skills and contain an average of 5 to
8 tutorials.
• Comprehensive books are great for a full-semester class, and contain 9 to 12+ tutorials.
So if the book you’re holding does not provide the right amount of coverage for you, there’s
probably another offering available. Go to our Web site or contact your Cengage Learning
sales representative to find out what else we offer.
CourseCasts – Learning on the Go. Always available…always relevant.
Want to keep up with the latest technology trends relevant to you? Visit
http://coursecasts.course.com to find a library of weekly updated podcasts, CourseCasts,
and download them to your mp3 player.
Ken Baldauf, host of CourseCasts, is a faculty member of the Florida State University Computer
Science Department where he is responsible for teaching technology classes to thousands of
FSU students each year. Ken is an expert in the latest technology trends; he gathers and sorts
through the most pertinent news and information for CourseCasts so your students can spend
their time enjoying technology, rather than trying to figure it out. Open or close your lecture
with a discussion based on the latest CourseCast.
Visit us at http://coursecasts.course.com to learn on the go!
Instructor Resources
We offer more than just a book. We have all the tools you need to enhance your lectures, check
students’ work, and generate exams in a new, easier-to-use and completely revised package. This
book’s Instructor’s Manual, Cengage Learning Testing Powered by Cognero, PowerPoint presentations, data files, solution files, figure files, and a sample syllabus are all available on this text’s
Instructor Companion Site. Simply search for this text at login.cengage.com.
SAM: Skills Assessment Manager
Get your students workplace-ready with SAM, the premier proficiency-based assessment and
training solution for Microsoft Office! SAM’s active, hands-on environment helps students
master computer skills and concepts that are essential to academic and career success.
Skill-based assessments, interactive trainings, business-centric projects, and comprehensive
remediation engage students in mastering the latest Microsoft Office programs on their own,
allowing instructors to spend class time teaching. SAM’s efficient course setup and robust
grading features provide faculty with consistency across sections. Fully interactive MindTap
Readers integrate market-leading Cengage Learning content with SAM, creating a comprehensive online student learning environment.
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
www.cengage.com/series/newperspectives
Acknowledgments
I would like to thank the people who worked so hard to make this book possible. Special
thanks to my developmental editor, Pam Conrad, for her excellent hard work and dedication in
editing this text, and to my Content Developer, Kathy Finnegan, who has worked tirelessly in
overseeing this project and made my task so much easier with her enthusiasm and good humor.
Other people at Cengage Learning who deserve credit are Jim Gish, Senior Product Manager;
Christian Kunciw, Manuscript Quality Assurance (MQA) Supervisor; and John Freitas, Serge
Palladino, Danielle Shaw, and Susan Whalen, MQA testers.
Feedback is an important part of writing any book, and thanks go to the following reviewers
for their helpful ideas and comments: David Doering, St. Louis Community College; Ravinder
Kang, Highline Community College; Diana Kokoska, University of Maine at Augusta; Barbara
Rader, University of Maryland; Sheryl Schoenacher, Farmingdale State College; Dave Sciuto,
University of Massachusetts—Lowell; John Whitney, Fox Valley Technical College; and Dawn
Wick, Southwestern Community College.
I want to thank my wife Joan for her support during this project and for my six children to
whom this book is dedicated.
– Patrick Carey
Many thanks to everyone who helped in this revision. Pam Conrad, my sharp-eyed developmental editor, suggested improvements and asked a lot of important questions that helped me
immeasurably in tightening up the material. The good advice of Kathy Finnegan, my Content
Developer, kept me focused on the important aspects of the revision process, and she
sweated a lot of the small stuff so I didn’t have to. I’m also grateful to Jim Gish, the Senior
Product Manager, for keeping the faith during the evolution of this revision. The staff at GEX
Publishing Services made it all look amazing. And MQA testers Serge Palladino, Danielle
Shaw, and Susan Whalen read everything through, completed all the steps, and gave smart
feedback that removed many roadblocks for future users. Finally, thanks to my husband, Jason
Bucy, for encouraging me to balance diving deep into XML with stepping away from the computer, getting outside, and enjoying the world with him.
– Sasha Vodnik
vi New Perspectives Series
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
XML 3rd Edition, Comprehensive vii
Tutorial 1 Creating an XML Document. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 1
Developing a Document for SJB Pet Boutique
Tutorial 2 Validating Documents with DTDs. . . . . . . . . . . . . . . . . . . . . . . . . . . XML 65
Creating a Document Type Definition for Map Finds For You
Tutorial 3 Validating Documents with Schemas. . . . . . . . . . . . . . . . . . . . . . . . XML 129
Creating a Schema for the ATC School of Information Technology
Tutorial 4 Working with Advanced Schemas. . . . . . . . . . . . . . . . . . . . . . . . . . XML 195
Creating Advanced Schemas for Higher Ed Test Prep
Tutorial 5 Transforming XML with XSLT and XPath. . . . . . . . . . . . . . . . . . . . . XML 251
Writing XML Data to an Output File
Tutorial 6 Functional Programming with XSLT and XPath 1.0. . . . . . . . . . . . . XML 323
Designing a Product Review Page
Tutorial 7 Building an XSLT Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 399
Working with IDs, Keys, and Groups
Tutorial 8 Building Applications with XSLT 2.0. . . . . . . . . . . . . . . . . . . . . . . . . XML 457
Exploring XSLT 2.0 and XPath 2.0
Tutorial 9 Exploring Data with XQuery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 529
Querying Sales Totals from a Database
Appendix A XML Schema Reference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML A1
Appendix B DTD Reference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML B1
Appendix C XSLT Elements and Attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . XML C1
Appendix D XPath Reference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML D1
Appendix E Using Saxon for XSLT and XQuery. . . . . . . . . . . . . . . . . . . . . . . . XML E1
Appendix F Understanding Regular Expressions. . . . . . . . . . . . . . . . . . . . . . . . XML F1
Glossary/Index REF 1
Brief Contents
XML
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
viii New Perspectives Series
Session 1.2 . . . . . . . . . . . . . . . . . . . . . . . . . XML 22
Working with Elements . . . . . . . . . . . . . . . . . . . XML 24
Empty Elements . . . . . . . . . . . . . . . . . . . . . . XML 25
Nesting Elements . . . . . . . . . . . . . . . . . . . . . XML 25
The Element Hierarchy . . . . . . . . . . . . . . . . . XML 26
Charting the Element Hierarchy . . . . . . . . . . XML 28
Writing the Document Body . . . . . . . . . . . . . XML 30
Working with Attributes . . . . . . . . . . . . . . . . . . XML 32
Using Character and Entity References . . . . . . . XML 35
Understanding Text Characters and
White Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 39
Parsed Character Data . . . . . . . . . . . . . . . . . XML 39
Character Data . . . . . . . . . . . . . . . . . . . . . . . XML 39
White Space . . . . . . . . . . . . . . . . . . . . . . . . . XML 40
Creating a CDATA Section . . . . . . . . . . . . . . XML 40
Formatting XML Data with CSS . . . . . . . . . . . . XML 44
Applying a Style to an Element . . . . . . . . . . XML 45
Inserting a Processing Instruction . . . . . . . . . . . XML 46
Working with Namespaces . . . . . . . . . . . . . . . . XML 49
Declaring a Namespace . . . . . . . . . . . . . . . . XML 49
Applying a Default Namespace . . . . . . . . . . XML 49
Session 1.2 Quick Check . . . . . . . . . . . . . . . . . . XML 51
Review Assignments . . . . . . . . . . . . . . . . . . . . . XML 52
Case Problems . . . . . . . . . . . . . . . . . . . . . . . . . . XML 54
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Tutorial 1 Creating an XML Document
Developing a Document for SJB Pet
Boutique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 1
Session 1.1 . . . . . . . . . . . . . . . . . . . . . . . . . . XML 2
Introducing XML . . . . . . . . . . . . . . . . . . . . . . . . . XML 4
The Roots of XML . . . . . . . . . . . . . . . . . . . . . . XML 4
XML Today . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 4
XML with Software Applications and
Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 5
XML and Databases . . . . . . . . . . . . . . . . . . . . XML 5
XML and Mobile Development . . . . . . . . . . . . XML 6
Creating an XML Vocabulary . . . . . . . . . . . . . XML 7
Standard XML Vocabularies . . . . . . . . . . . . . . XML 8
DTDs and Schemas . . . . . . . . . . . . . . . . . . . . XML 10
Well-Formed and Valid XML
Documents . . . . . . . . . . . . . . . . . . . . . . . . . . XML 10
Creating an XML Document . . . . . . . . . . . . . . . XML 11
The Structure of an XML
Document . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 11
The XML Declaration . . . . . . . . . . . . . . . . . . XML 12
Inserting Comments . . . . . . . . . . . . . . . . . . . XML 14
Processing an XML Document . . . . . . . . . . . . . XML 16
XML Parsers . . . . . . . . . . . . . . . . . . . . . . . . . XML 16
Session 1.1 Quick Check . . . . . . . . . . . . . . . . . . XML 21
Table of Contents
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
XML 3rd Edition, Comprehensive ix
Session 2.3 . . . . . . . . . . . . . . . . . . . . . . . . XML 104
Introducing Entities . . . . . . . . . . . . . . . . . . . . . XML 106
Working with General Entities . . . . . . . . . . . . . XML 106
Creating Parsed Entities................XML 107
Referencing a General Entity . . . . . . . . . . . XML 108
Working with Parameter Entities . . . . . . . . . . . XML 113
Inserting Comments into a DTD . . . . . . . . . . . XML 115
Creating Conditional Sections . . . . . . . . . . . . . XML 116
Working with Unparsed Data . . . . . . . . . . . . . XML 117
Validating Standard Vocabularies . . . . . . . . . . XML 119
Session 2.3 Quick Check . . . . . . . . . . . . . . . . . XML 121
Review Assignments . . . . . . . . . . . . . . . . . . . . XML 122
Case Problems . . . . . . . . . . . . . . . . . . . . . . . . . XML 123
Tutorial 3 Validating Documents with Schemas
Creating a Schema for the ATC School of
Information Technology . . . . . . . . . . . . . . . . . . . . . XML 129
Session 3.1 . . . . . . . . . . . . . . . . . . . . . . . . XML 130
Introducing XML Schema . . . . . . . . . . . . . . . . XML 132
The Limits of DTDs . . . . . . . . . . . . . . . . . . . XML 133
Schemas and DTDs . . . . . . . . . . . . . . . . . . . XML 133
Schema Vocabularies . . . . . . . . . . . . . . . . . XML 134
Starting a Schema File . . . . . . . . . . . . . . . . . . . XML 135
Understanding Simple and Complex
Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 137
Defining a Simple Type Element . . . . . . . . . . . XML 138
Defining an Attribute . . . . . . . . . . . . . . . . . . . . XML 139
Tutorial 2 Validating Documents with DTDs
Creating a Document Type Definition for Map
Finds For You . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 65
Session 2.1 . . . . . . . . . . . . . . . . . . . . . . . . . XML 66
Creating a Valid Document . . . . . . . . . . . . . . . . XML 68
Declaring a DTD . . . . . . . . . . . . . . . . . . . . . . XML 71
Writing the Document Type Declaration . . . XML 74
Declaring Document Elements..............XML 75
Elements Containing Any Type of
Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 76
Empty Elements . . . . . . . . . . . . . . . . . . . . . . XML 76
Elements Containing Parsed Character
Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 77
Working with Child Elements . . . . . . . . . . . . . . XML 78
Specifying an Element Sequence . . . . . . . . . XML 78
Specifying an Element Choice . . . . . . . . . . . XML 79
Modifying Symbols . . . . . . . . . . . . . . . . . . . . XML 80
Session 2.1 Quick Check . . . . . . . . . . . . . . . . . . XML 83
Session 2.2 . . . . . . . . . . . . . . . . . . . . . . . . . XML 84
Declaring Attributes . . . . . . . . . . . . . . . . . . . . . XML 86
Working with Attribute Types . . . . . . . . . . . . . . XML 89
Character Data . . . . . . . . . . . . . . . . . . . . . . . XML 90
Enumerated Types . . . . . . . . . . . . . . . . . . . . XML 91
Tokenized Types . . . . . . . . . . . . . . . . . . . . . . XML 92
Working with Attribute Defaults . . . . . . . . . . . . XML 95
Validating an XML Document . . . . . . . . . . . . . . XML 97
Session 2.2 Quick Check . . . . . . . . . . . . . . . . . XML 103
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
x New Perspectives Series
Deriving Data Types Using Regular
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 177
Introducing Regular Expressions . . . . . . . . XML 178
Applying a Regular Expression . . . . . . . . . . XML 180
Session 3.2 Quick Check . . . . . . . . . . . . . . . . . XML 183
Review Assignments . . . . . . . . . . . . . . . . . . . . XML 184
Case Problems . . . . . . . . . . . . . . . . . . . . . . . . . XML 185
Tutorial 4 Working with Advanced Schemas
Creating Advanced Schemas for Higher Ed
Test Prep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 195
Session 4.1 . . . . . . . . . . . . . . . . . . . . . . . . XML 196
Designing a Schema . . . . . . . . . . . . . . . . . . . . XML 198
Flat Catalog Design . . . . . . . . . . . . . . . . . . XML 198
Russian Doll Design . . . . . . . . . . . . . . . . . . . XML 200
Venetian Blind Design . . . . . . . . . . . . . . . . . XML 202
Session 4.1 Quick Check . . . . . . . . . . . . . . . . . XML 205
Session 4.2 . . . . . . . . . . . . . . . . . . . . . . . . XML 206
Combining XML Vocabularies . . . . . . . . . . . . . XML 208
Creating a Compound Document . . . . . . . XML 210
Understanding Name Collision . . . . . . . . . . XML 212
Working with Namespaces in an Instance
Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 213
Declaring and Applying a Namespace to
a Document . . . . . . . . . . . . . . . . . . . . . . . . . XML 213
Applying a Namespace to an Element . . . . XML 215
Working with Attributes . . . . . . . . . . . . . . . XML 217
Defining a Complex Type Element . . . . . . . . . XML 141
Defining an Element Containing Only
Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . XML 142
Defining an Element Containing
Attributes and Basic Text . . . . . . . . . . . . . . XML 142
Referencing an Element or Attribute
Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 143
Defining an Element with Nested
Children . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 145
Defining an Element Containing Nested
Elements and Attributes . . . . . . . . . . . . . . . XML 147
Indicating Required Attributes . . . . . . . . . . . . XML 150
Specifying the Number of Child
Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 152
Validating a Schema Document . . . . . . . . . . . XML 153
Applying a Schema to an Instance
Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 155
Session 3.1 Quick Check . . . . . . . . . . . . . . . . . XML 159
Session 3.2 . . . . . . . . . . . . . . . . . . . . . . . . XML 160
Validating with Built-In Data Types . . . . . . . . . XML 162
String Data Types . . . . . . . . . . . . . . . . . . . . XML 163
Numeric Data Types . . . . . . . . . . . . . . . . . . XML 164
Data Types for Dates and Times . . . . . . . . . XML 165
Deriving Customized Data Types . . . . . . . . . . XML 168
Deriving a List Data Type . . . . . . . . . . . . . . XML 170
Deriving a Union Data Type . . . . . . . . . . . . XML 170
Deriving a Restricted Data Type . . . . . . . . . XML 171
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
XML 3rd Edition, Comprehensive xi
Introducing XSLT Templates . . . . . . . . . . . . . . XML 263
The Root Template . . . . . . . . . . . . . . . . . . . XML 263
Literal Result Elements . . . . . . . . . . . . . . . . XML 264
Defining the Output Format . . . . . . . . . . . . XML 266
Transforming a Document . . . . . . . . . . . . . . . . XML 268
Running Transformations Using
Saxon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 269
Session 5.1 Quick Check . . . . . . . . . . . . . . . . . XML 273
Session 5.2 . . . . . . . . . . . . . . . . . . . . . . . . XML 274
Extracting Element Values . . . . . . . . . . . . . . . . XML 276
Using the for-each Element . . . . . . . . . . XML 280
Working with Templates . . . . . . . . . . . . . . . . . XML 281
Applying a Template . . . . . . . . . . . . . . . . . . XML 282
Displaying Attribute Values . . . . . . . . . . . . . . . XML 285
Combining Node Sets . . . . . . . . . . . . . . . . . . . XML 288
Session 5.2 Quick Check . . . . . . . . . . . . . . . . . XML 291
Session 5.3 . . . . . . . . . . . . . . . . . . . . . . . . XML 292
Inserting a Value into an Attribute . . . . . . . . . XML 294
Sorting Node Sets . . . . . . . . . . . . . . . . . . . . . . XML 295
Conditional Processing . . . . . . . . . . . . . . . . . . XML 297
Using Comparison Operators and
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 298
Testing for Multiple Conditions . . . . . . . . . XML 299
Filtering XML with Predicates . . . . . . . . . . . . . XML 302
Predicates and Node Position . . . . . . . . . . XML 303
Predicates and Functions . . . . . . . . . . . . . . XML 303
Associating a Schema with a Namespace . . . . XML 219
Targeting a Namespace . . . . . . . . . . . . . . . XML 219
Including and Importing Schemas . . . . . . . XML 222
Referencing Objects from Other Schemas . . XML 223
Combining Standard Vocabularies . . . . . . . . . XML 225
Session 4.2 Quick Check . . . . . . . . . . . . . . . . . XML 227
Session 4.3 . . . . . . . . . . . . . . . . . . . . . . . . XML 228
Adding a Namespace to a Style Sheet . . . . . . XML 230
Declaring a Namespace in a Style Sheet . . XML 232
Qualifying Elements and Attributes by
Default . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 235
Session 4.3 Quick Check . . . . . . . . . . . . . . . . . XML 239
Review Assignments . . . . . . . . . . . . . . . . . . . . XML 240
Case Problems . . . . . . . . . . . . . . . . . . . . . . . . . XML 241
ProSkills Exercise: Decision Making . . . . . . . . XML 248
Tutorial 5 Transforming XML with XSLT and XPath
Writing XML Data to an Output File . . . . . . . . . . . . XML 251
Session 5.1 . . . . . . . . . . . . . . . . . . . . . . . . XML 252
Introducing XSL and XSLT . . . . . . . . . . . . . . . . XML 254
XSLT Style Sheets and Processors . . . . . . . XML 254
Attaching an XSLT Style Sheet . . . . . . . . . . XML 255
Starting an XSLT Style Sheet . . . . . . . . . . . . XML 258
Introducing XPath . . . . . . . . . . . . . . . . . . . . . . XML 259
Working with Nodes . . . . . . . . . . . . . . . . . . XML 259
Absolute and Relative Location Paths . . . . XML 260
Text, Comment, and Process Instruction
Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 262
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
xii New Perspectives Series
Accessing an External Style Sheet . . . . . . . . . XML 339
Including a Style Sheet.................XML 339
Importing a Style Sheet . . . . . . . . . . . . . . . XML 339
Session 6.1 Quick Check . . . . . . . . . . . . . . . . . XML 341
Session 6.2 . . . . . . . . . . . . . . . . . . . . . . . XML 342
Creating a Lookup Table in XSLT . . . . . . . . . . . XML 344
Working with Numeric Functions . . . . . . . . . . XML 347
Applying Mathematical Operators . . . . . . . . . XML 349
Numerical Calculations in XPath 2.0 . . . . . . XML 351
Formatting Numeric Values . . . . . . . . . . . . . . . XML 351
Using the format-number() Function . XML 352
International Number Formats . . . . . . . . . . XML 352
Working with Text Strings . . . . . . . . . . . . . . . . XML 355
Extracting and Combining Text Strings . . . XML 355
Formatting a Date String . . . . . . . . . . . . . . XML 356
Working with White Space ..............XML 360
Session 6.2 Quick Check . . . . . . . . . . . . . . . . . XML 361
Session 6.3 . . . . . . . . . . . . . . . . . . . . . . . XML 362
Introducing Parameters . . . . . . . . . . . . . . . . . . XML 364
Setting a Global Parameter Value . . . . . . . . XML 365
Exploring Template Parameters . . . . . . . . . XML 367
Using Named Templates . . . . . . . . . . . . . . . . . XML 368
Introducing Functional Programming . . . . . . . XML 369
Understanding Recursion............... XML 371
Creating a Recursive Template . . . . . . . . . . XML 372
Session 6.3 Quick Check . . . . . . . . . . . . . . . . . XML 384
Constructing Elements and Attributes
with XSLT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 307
Constructing an Element Node . . . . . . . . . XML 308
Constructing Attributes and Attribute
Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 309
Constructing Comments and Processing
Instructions . . . . . . . . . . . . . . . . . . . . . . . . . XML 310
Session 5.3 Quick Check . . . . . . . . . . . . . . . . . XML 312
Review Assignments . . . . . . . . . . . . . . . . . . . . XML 313
Case Problems . . . . . . . . . . . . . . . . . . . . . . . . . XML 315
Tutorial 6 Functional Programming with XSLT
and XPath 1.0
Designing a Product Review Page . . . . . . . . . . . . . . XML 323
Session 6.1 . . . . . . . . . . . . . . . . . . . . . . . . XML 324
Using XSLT Variables . . . . . . . . . . . . . . . . . . . . XML 326
Creating a Variable . . . . . . . . . . . . . . . . . . . XML 326
Understanding Variable Scope . . . . . . . . . . XML 327
Applying a Variable . . . . . . . . . . . . . . . . . . . XML 327
Referencing a Variable . . . . . . . . . . . . . . . . XML 329
Copying Nodes . . . . . . . . . . . . . . . . . . . . . . . . XML 331
The copy Element . . . . . . . . . . . . . . . . . . . XML 332
The copy-of Element . . . . . . . . . . . . . . . XML 333
Retrieving Data from Multiple Files . . . . . . . . . XML 335
The document() and doc() Functions . XML 335
Applying the document() Function . . . . XML 336
Retrieving Data from a nonXML File . . . . . . . . . . . . . . . . . . . . . . . . . . . XML 338
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.