XML, DTDs, Schemas:
The Personal Trainer
William R. Stanek
PUBLISHED BY
Stanek & Associates
PO Box 362
East Olympia, WA 98540-0362
Copyright 2014 William R. Stanek
All rights reserved. No part of the contents of this book may be reproduced, stored or transmitted in any form or by any means without the express written permission of the publisher.
United States of America
Stanek & Associates is a trademark of William R. Stanek. All other marks are property of their respective owners.
The example names for companies, organizations, persons and other named elements used in the book are fictitious. No association with any real company, organization, person or other named element is intended or should be inferred.
This book expresses the authors views and opinions. The information contained herein is provided without any express, statutory or implied warranties. Neither the authors, the publishers, the resellers nor distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book.
Cover Design: Creative Designs Ltd.
Editorial Development: Andover Publishing Solutions
Technical Review: L & L Technical Content Services
You can provide feedback related to this book by emailing the author at williamstanek@aol.com. Please use the name of the book as the subject line.
Contents at a Glance
Table of Contents
Introduction
XML, DTDs, Schemas: The Personal Trainer is an authoritative quick reference guide to the eXtensible Markup Language (XML) and is designed to be a key resource you turn to whenever you have questions about XML. To this end, the book zeroes in on the key aspects of XML that you'll use the most.
Inside this books pages, you'll find comprehensive overviews, step-by-step procedures, frequently used tasks, documented examples, and much more. One of the goals is to keep the content so concise that the book remains compact and easy to navigate while at the same time ensuring that the book is packed with as much information as possiblemaking it a valuable resource.
What is this Book About?
XML, DTDs, Schemas: The Personal Trainer focuses on the essentials of the XML standard and provides discussions of key related technologies that you'll need to be successful with XML. The book is designed for anyone who wants to learn XML, including those who create or support XML-based solutions.
To pack in as much information as possible, I had to assume that you have basic technology skills and a basic understanding of the Internet, the World Wide Web, and markup languages, such as Hypertext Markup Language (HTML). With this in mind, I dont devote entire chapters to understanding the World Wide Web, markup languages, or how structured documents can be used on the Web. You should already know this material or have resources to study. I do, however, provide a detailed introduction to XML and its related technologies that serves as the start of your foray into the world of XML. I also examine the structure of XML documents.
As I stated, I assume that youre familiar with the Internet and the Web. For example, I might talk about transfer protocols, such as Hypertext Transfer Protocol (HTTP), in various contexts and assume that you know that HTTP is used to transfer information over the Web. I might also discuss documents that use HTML and compare them to documents that use XML. Again, I'll assume that you know the basics of HTML and the Web. If you don't (or have forgotten what you previously learned), I'd recommend getting a book that covers the basics of the Internet and the basics of Web publishing.
How Is This Book Organized?
XML, DTDs, Schemas: The Personal Trainer is designed to be studied as a resource guide and used as a quick reference to meet your everyday needs when you are implementing or maintaining XML-based solutions. Speed and ease of reference is an essential part of this hands-on guide. The book has an expanded table of contents and many other quick reference features have been added as well. These features include quick step-by-step instructions, lists, and fast facts. The book is broken down into seven chapters.
Chapter 1 provides a background on the development of XML, a review of XML-based technologies, and a brief discussion on creating XML-based solutions. In Chapter 2 you'll learn XML naming rules, how XML documents are organized, and how to work with key XML structures, including elements, attributes, entities, processing instructions, and comments.
Next, youll examine the essential tasks for working with DTDs and XML namespaces. DTDs provide a way to describe the structure of XML documents in terms of the elements, attributes, and contents they can contain. You use XML namespaces to prevent naming conflicts when like-named elements and attributes are associated with different types of data structures and used in the same document. Chapter 3 discusses techniques you can use to create DTDs. Chapters 4 through 6 delve into the details of how you can define elements, attributes, entities, and notations in DTDs.
Chapter 7 zeroes in on XML namespaces and explains how namespaces are defined and referenced in documents that use DTDs. Because many XML-based technologies, including XML Schemas, are implemented through DTDs, a solid understanding of DTDs and how they work is essential to your successeven if you don't plan to use DTDs.
Chapters 8 to 12 focus on the XML Schema language. XML Schemas provide an alternative way to describe the structure of XML documents in terms of the elements, attributes, and contents they can contain. Chapter 8 introduces the XML Schema language and its related concepts. The chapter also discusses how namespaces are used with schemas. Chapters 9 to 11 cover the details of the XML schema language. Chapter 12 provides a resource guide to schema declarations that is designed to clarify schema usage.
What Conventions Are Used in This Book?
Ive used a variety of elements to help keep the text clear and easy to follow. Youll find code terms and listings in monospace type, except when I tell you to actually type a command. In that case, the command appears in bold type. When I introduce and define a new term, I put it in italics.
This book also has notes, tips and other sidebar elements that provide additional details on points that need emphasis.
I truly hope you find that XML, DTDs, Schemas: The Personal Trainer helps you use XML successfully and effectively. Keep in mind that throughout this guide, where I have used click, right-click and double-click, you can also use touch equivalents, tap, press and hold, and double tap.
Thank you,
William R. Stanek
()
Chapter 1. XML Essentials
XML, or eXtensible Markup Language, is a programming language that can be used to describe other languages and a specification for storing information. Although XML and HTML may seem to have a lot in common, in reality the difference between them is like the difference between night and day. HTML is used to format information, but it isnt very useful when it comes to describing information. For example, you can use HTML to format a table, but you cant use HTML to describe the data elements within the table. The reason for this is that you cant really depict something as abstract as a distributor or a customer with HTML, which is where XML comes into the picture. XML can be, and is, used to define the structure of data rather than its format.
What makes XML so powerful is that any type of dataeven abstract data conceptscan be given form and structure. You give data conceptssuch as distributor, purchase order, and inventoryform by describing their components and the relationship between those components. Instead of the abstract concept of a distributor, you have a specified structure that describes the distributor-related information, such as distributor name, contact name, and address. You could define the structure of an inventory item handled by the distributor with components such as item number, name, description, unit cost, and suggested retail price.
Next page