SlideShare a Scribd company logo
Xml Schema Essentials First Edition R Allen Wyke
Andrew Watt download
https://ebookbell.com/product/xml-schema-essentials-first-
edition-r-allen-wyke-andrew-watt-55675806
Explore and download more ebooks at ebookbell.com
Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Xml Schema Essentials R Allen Wyke Andrew Watt
https://ebookbell.com/product/xml-schema-essentials-r-allen-wyke-
andrew-watt-4123010
Xml Schema 1st Eric Van Der Vlist
https://ebookbell.com/product/xml-schema-1st-eric-van-der-
vlist-2158922
Definitive Xml Schema Walmsley Priscilla
https://ebookbell.com/product/definitive-xml-schema-walmsley-
priscilla-22041322
Definitive Xml Schema 2nd Edition Walmsley Priscilla
https://ebookbell.com/product/definitive-xml-schema-2nd-edition-
walmsley-priscilla-11789498
The Xml Schema Complete Reference 1st Cliff Binstock
https://ebookbell.com/product/the-xml-schema-complete-reference-1st-
cliff-binstock-2158748
Modeling Business Objects With Xml Schema 1st Edition Berthold Daum
https://ebookbell.com/product/modeling-business-objects-with-xml-
schema-1st-edition-berthold-daum-4646270
The Art Of Xsd Sql Server Xml Schema Collections Sebastian J
https://ebookbell.com/product/the-art-of-xsd-sql-server-xml-schema-
collections-sebastian-j-51224516
The Art Of Xsd Sql Server Xml Schemas Jacob Sebastian
https://ebookbell.com/product/the-art-of-xsd-sql-server-xml-schemas-
jacob-sebastian-1730398
Xml For Bioinformatics 1st Edition Ethan Cerami
https://ebookbell.com/product/xml-for-bioinformatics-1st-edition-
ethan-cerami-2031382
Xml Schema Essentials First Edition R Allen Wyke Andrew Watt
T
E
A
M
F
L
Y
XML Schema Essentials
John Wiley & Sons, Inc.
Wiley Computer Publishing
R. Allen Wyke
Andrew Watt
Xml Schema Essentials First Edition R Allen Wyke Andrew Watt
XML Schema Essentials
John Wiley & Sons, Inc.
Wiley Computer Publishing
R. Allen Wyke
Andrew Watt
Publisher: Robert Ipsen
Editor: Cary Sullivan
Developmental Editor: Scott Amerman
Associate Managing Editor: Penny Linskey
Associate New Media Editor: Brian Snapp
Text Design & Composition: D&G Limited, LLC
Designations used by companies to distinguish their products are often claimed as
trademarks. In all instances where John Wiley & Sons, Inc., is aware of a claim, the product
names appear in initial capital or ALL CAPITAL LETTERS. Readers, however, should contact
the appropriate companies for more complete information regarding trademarks and
registration.
This book is printed on acid-free paper.
Copyright © 2002 by R. Allen Wyke and Andrew Watt. All rights reserved.
Published by John Wiley & Sons, Inc.
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 Copy-
right 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) 750-4744. Requests to the
Publisher for permission should be addressed to the Permissions Department, John Wiley
& Sons, Inc., 605 Third Avenue, New York, NY 10158-0012, (212) 850-6011, fax (212) 850-
6008, E-Mail: PERMREQ @ WILEY.COM.
This publication is designed to provide accurate and authoritative information in regard to
the subject matter covered. It is sold with the understanding that the publisher is not
engaged in professional services. If professional advice or other expert assistance is
required, the services of a competent professional person should be sought.
Library of Congress Cataloging-in-Publication Data:
ISBN: 0-471-412597
Printed in the United States of America.
10 9 8 7 6 5 4 3 2 1
Introduction ix
Acknowledgments xi
About the Authors xiii
Part One Getting Started 1
Chapter 1 Elementary XML Schema 3
What Is XML Schema? 5
How Does an XML Schema Processor Work? 6
What Is XML Schema for? 7
XSD Schema Schema Components 7
Other Schema Languages for XML 8
The DTD Descended from SGML 8
XSD Schema Tools 9
XML Schema Document 14
C HAPTE R
Contents
iii
Root of an XML Schema Document 16
Declaring the Location of Your XML Schema Document 16
Declaring Elements and Defining Types 17
Defining Simple Types 17
Defining Complex Types 25
Anonymous Complex Types 25
Named Complex Types 26
Using Anonymous or Named Complex Types 29
Declarations 34
Annotations in Schema 42
Standard XML Comments 42
The <annotation> Element 43
Empty Element Declaration 45
The anyType Type 50
Occurrence Constraints 51
Cardinality in DTDs 51
minOccurs and maxOccurs 51
Defining Your Own Simple Type 56
Model Groups in Schema 57
Sequence Group 57
Choice Group 57
All Group 58
Attribute Groups 61
More about the XML 1.0 DTD Content Model 62
Validation in XSD Schema 63
Validation versus Assessment 64
XML Information Set 67
Post-Schema Validation Infoset 69
Summary 69
Chapter 2 XSD Elements 71
XML Elements 72
Defining within a DTD 72
Limitations 76
iv Contents
Moving On to XSD Elements 77
<xsd:element>: A Closer Examination 81
Default Values 83
Substitution Groups 85
Null Values 92
Attributes 93
Complex Content 99
Importing Elements from Other Locations 107
Redefining Elements 111
More on <xsd:complexType> 112
Using a Sequence 114
Grouping 114
Summary 119
Chapter 3 Adding Attributes 121
What Are Attributes? 122
Additional Metadata 122
Application Uses 125
Storing Data 126
Hybrid Approaches 128
Considerations for Using Attributes 130
XML Attributes Foundation 130
Syntax 130
Capabilities 131
XSD Attributes: The Next Generation 132
Syntax Changes 132
Further Capabilities 134
Using Attributes 136
Scope 136
Qualification 138
Defaults 140
Grouping 141
Inclusion of Other Attributes 142
Summary 142
Contents v
Part Two Going Beyond DTDs 145
Chapter 4 Applying Datatypes 147
What Are Datatypes? 147
Primitive Datatypes 149
Derived Datatypes 152
Defining Our Own Datatypes 152
More on Simple Types 157
Defining Lists 160
Creating a Union 162
Constraining Type Definitions 167
Controlling Digits 171
Handling White Space 174
Pattern Matching 180
Applicability of Facets 181
Summary 183
Chapter 5 Data Facets 185
Fundamental and Constraining Facets 186
Constraining Facets in XSD Schema 186
The length Element 187
The minLength Element 195
The maxLength Element 198
The pattern Element 200
Parts Catalog Example 202
Postal Code Examples 206
The enumeration Element 211
Simple Enumeration Example 212
U.S. States Example 213
The whiteSpace Element 216
Summary 217
Chapter 6 More about Data Facets 219
The maxExclusive Element 220
The maxInclusive Element 223
The minExclusive Element 225
vi Contents
The minInclusive Element 228
The totalDigits and fractionDigits Facets 233
Summary 238
Chapter 7 Grouping Elements and Attributes 239
Reusing Definitions with Groups 240
Nesting Sequence Groups 245
Nesting Choice Groups 246
Substitution Groups 250
Attribute Groups 257
Summary 258
Chapter 8 Deriving Types 259
Deriving Types by Extension 260
Deriving Types by Restriction 271
The enumeration Element 279
The pattern Element 282
The xsi:type Attribute 284
Summary 285
Part Three Next Steps 287
Chapter 9 Uniqueness and Keys in XSD Schema 289
Identity-Constraint Definitions 289
The <xsd:unique> Element 290
The <xsd:key> and <xsd:keyref> Elements 298
Summary 303
Chapter 10 Bringing the Parts Together 305
Modularizing Schemas 305
How to Use Schema Modules 306
Creating the Example 325
Planning the Example 325
Defining the Information Needs 325
Documenting the Schema 326
Basic Schema Templates 327
Modularizing the Schemas 328
Contents vii
Creating the Staff Schema 329
Starting the Schema 332
Creating the Customer Schema 342
Creating the Type Library 342
Part Four Appendixes 347
Appendix A Datatypes 349
Appendix B Data Facets 371
Index 379
viii Contents
T
E
A
M
F
L
Y
Back in February 1998, XML 1.0 was released among the most hype and media
coverage that the Internet community had seen since the first version of Java.
XML was supposed to solve many of the problems that existed in heteroge-
neous environments, where applications were forced to communicate and
exchange data in proprietary formats. The explosion of the Web had intro-
duced the common HTML format for marking up and exchanging documents,
but the structure and potential of HTML to be more than that simply did not
exist.
XML, whose foundation was based on SGML, provided a means for people,
companies, or entire industries to define languages that could be used to
mark up data in a method that others could support and understand. Simply
conforming to the well-formed and valid (which is technically optional)
requirements of XML was a huge step, and if you coupled that with inherit
structure of document type definitions (DTD), users were able to provide a
wealth of knowledge to partners with whom they exchanged data. XML
offered some datatyping, however, and did not really support a more flexible
means of defining schemas.
To help accommodate these deficiencies, other standards such as Datatypes
for DTDs (DT4DTD), Schema for Object-Oriented XML (SOX), XML Data, and
Introduction
ix
Document Definition Markup Language (DDML) were developed and combined
with XML data for exchanges. But while these provided many of the features
that users needed, integrating multiple standards were cumbersome and less
desired than a single, standard approach. Enter XML Schema (XSD).
XSD, which was inspired by all the previously mentioned standards, does
not necessarily replace XML—but in many senses of the word, it can be
thought of as XML on steroids. It can be the perfect solution for large solutions
that include many various types of data integration. When you have applica-
tions or entire systems that need to communicate yet have very diverse meth-
ods of storing data, XSD can act as the bridge between these systems. These
complex solutions need more, and XSD offers that.
What to Expect
In XML Schema Essentials, our job as authors is to expose you to the various
publications that are part of the XSD Recommendations. For those of you who
have attempted to read and study the recommendations, you know that it can
be complex and hard to follow. But just knowing and understanding the stan-
dard is only half the battle. We will also expose you to using it to solve real-
world problems as well as have discussions about best practices and how you
can get the most out of your implementation.
Our goal is simple: for you to finish this book and not only understand XSD
but also understand what you can do with it.
Book Organization
In our attempt to teach you XSD, we have taken the approach of stepping
through the recommendations from a functional standpoint rather than from
top to bottom. The book itself is divided into four parts. The first part, “Get-
ting Started,” introduces you to XSD. You will learn the basic concepts, how to
define elements, and how to add attributes to those elements.
Part Two, “Going beyond DTDs,” will focus on functionality that is open
and beyond that found in XML DTDs. You will learn about datatypes and how
to derive your own datatypes. There are also a couple of chapters that focus on
data facets, which are ways you can constrain things such as datatypes. There
is also a chapter on grouping elements and attributes. One of the things you
will quickly learn about XSD is that you can define more than one root ele-
ment.
The third part of the book, “Next Steps,” is just that: next steps. In the final
two chapters of the book, which are contained in this section, you will learn
about some advanced topics that revolve around the use of XSD schemas and
x Introduction
essentially expose yourself to a deeper level of topics than covered in previous
chapters. You will also work through an example that ties together everything
you have learned up until this point to result in a full understanding of XSD.
Finally, in Part Four, which contains Appendixes A and B, we have included
a reference for both the datatypes (primitive and derived) and the facets avail-
able in the XSD Recommendations. We hope that you will use the material
contained here even after you have finished reading the book, because it can
serve as a valuable reference.
A Final Thought
This brief introduction should basically prepare you for what to expect from
the pages that follow. We did not want to waste your time here rambling on
about random thoughts of how XSD will solve the world’s problems. Simply
put, we want you to come to your own conclusions. So, we have saved our
discussion of why and how XSD could possibly do so, at least in the comput-
ing world, for the chapters and pages within the book itself.
R. Allen Wyke
Andrew Watt
Acknowledgments
R. Allen Wyke
On the publishing side, I would like to thank Bob Kern of TIPS Publishing and
my co-author, Andrew, for their professionalism, hard work, and overall sup-
port in the proposing and writing of this book. I would also like to thank all
the people at Wiley who worked on the book and helped make sure it was the
best it could be.
Andrew Watt
I would like to thank my co-author, Allen, for his contribution to the develop-
ment and writing of this book. Thanks, too, to Scott Amerman, Penny Linskey,
and the team at Wiley for doing all that was necessary to bring this book to
fruition.
Introduction xi
I would like to dedicate this book to the
citizens of New York City, the United States of
America, and the world for their perseverance
and strength following the tragic events that
occurred September 11, 2001.
R. Allen Wyke
I would like to dedicate this book to the
memory of my late father, George Alec Watt,
a very special human being.
Andrew Watt
R. Allen Wyke
R. Allen Wyke of Durham, North Carolina is the Vice-President of Technology
at Blue292, a pioneering company on the forefront of environment, health,
safety, and emergency management software and services. At Blue292, he
works with management and engineering to help ensure and create products
that have the proper vision and direction while fulfilling customers’ expecta-
tions. He is constantly working with Java, XML, JavaScript, and other related
Internet technologies—all of which are part of the framework used for the
Blue292 systems.
Allen, who wrote his first computer program at the age of eight, has also
developed intranet Web pages for a leading telecommunications and net-
working company in addition to working on several Internet sites. He has
programmed in everything from C++, Java, Perl, Visual Basic, and JavaScript
to Lingo as well as having experience with both HTML/XHTML and DHTML.
He has also published roughly a dozen books on various Internet technologies
that include topics such as Perl, JavaScript, PHP, and XML. In the past, he has
also written the monthly “Webmaster” column for SunWorld and a weekly
article, “Integrating Windows and Unix,” for ITworld.com.
About the Authors
xiii
xiv About the Authors
Andrew Watt
Andrew Watt is an independent consultant and author based in the United
Kingdom with an interest and expertise in the growing family of XML tech-
nologies. He wrote his first programs in 6502 Assembly Language and BBC
Basic around 1985 and has programmed in Pascal, Prolog, Lotus Domino, and
a variety of Web and other technologies including HTML/XHTML and
JavaScript. He works with XML, XSLT, SVG, and various other XML technolo-
gies on a regular basis and is excited by the progressive transition of the XML
technologies from potential to reality as the pieces of the XML jigsaw puzzle
appear one by one from the World Wide Web Consortium (W3C).
Andrew is the author of Designing SVG Web Graphics (published by New
Riders) and XPath Essentials (published by Wiley) as well as being co-author
or contributing author to XHTML, XML & Java 2 Platinum Edition (published
by Que), Professional XSL, Professional XML 2nd Edition and Professional XML
Meta Data (published by Wrox), and Sams Teach Yourself JavaScript in 21 Days
(in press at Sams).
PA RT
1
Getting Started
Xml Schema Essentials First Edition R Allen Wyke Andrew Watt
3
C HAPTE R
1
Elementary XML Schema
The World Wide Web Consortium’s XML Schema is arguably one of the most
important and far-reaching recommendations related to XML to come from
the W3C.
Since its introduction as a W3C recommendation in 1998, Extensible Markup
Language (XML) has had a rapidly growing impact on the World Wide Web
and as a basis for electronic business. As the impact of XML has grown, the
need to integrate XML with existing technologies, such as programming lan-
guages and relational database management systems, and the need to
exchange information expressed in XML has led to demands for a schema lan-
guage written in XML that will constrain the allowed structure of a class of
XML documents with precision and that can also constrain the datatypes that
are permitted at individual locations within such a structure. The need for a
new schema language arose, in part, from the limitations of the Document Type
Definition (DTD), which was the form of XML schema defined within the XML
1.0 Recommendation of February 1998.
As well as being one of the most important recommendations, the W3C
XML Schema Recommendation is one of the most complex, and at times
abstract, XML technology specifications. In this book, we will be emphasizing
aspects of W3C XML Schema that are practical, using many examples of W3C
4 Chapter 1
<?xml version="1.0"?>
<Book>
<Title>XML Schema Essentials</Title>
<Authors>
<Author>R. Allen Wyke</Author>
<Author>Andrew Watt</Author>
</Authors>
<Publisher>John Wiley</Publisher>
</Book>
Listing 1.1 Simple XML instance document (Book.xml).
XML schemas and introducing the theory that sheds light on the practical use
of schemas.
Let’s take a quick look at a simple XML schema so that you can see what one
looks like. An XML document that is described by an XML schema is called an
instance document. Listing 1.1 shows a very simple XML instance document.
A schema expressed in W3C XML Schema syntax that describes the permit-
ted content of Listing 1.1 is shown in Listing 1.2. The details of the syntax are
not essential for you to understand at this stage.
As you can see, the schema of XMLSchema is substantially longer than the doc-
ument it describes or defines. For the moment, do not worry about the detail of
the schema. The <xsd:annotation> and <xsd:documentation> elements enable us
to document the purpose of a schema for a human reader. The <xsd:element> and
<xsd:attribute> elements enable us to declare elements and attributes that are per-
mitted in instance documents. The <xsd:complexType> element enables us to
define the permitted complex type content of certain elements. How to use XSD
Schema elements such as <xsd:element>, <xsd:complexType>, <xsd:attribute>,
and so on will be introduced a little later in this chapter.
The World Wide Web Consortium, or W3C, has termed its version
of a schema language as simply XML Schema. In reality, a number of other
XML schema languages existed for some time before W3C completed the
development of XML Schema. So, to avoid ambiguity, when we refer to the
specification for the W3C flavor of XML Schema, we will use the terms W3C
XML Schema or XSD Schema to refer to W3C’s type of XML Schema, because an
earlier name for the W3C XML Schema was XML Schema Definition Language,
abbreviated to XSD. When we refer to a specific example of a schema written in
the XSD Schema language (with the upper-case initial letter of Schema), we will
use the term XSD schema (with the lower-case initial letter of schema).
Throughout this book, we will be using the indicative namespace prefix xsd
to refer to elements such as <xsd:complexType> (which are part of XSD
Schema).
NOTE
T
E
A
M
F
L
Y
Elementary XML Schema 5
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:annotation>
<xsd:documentation>
This is a sample XML Schema for Chapter 1 of XML Schema
Essentials.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="Book">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Title" ref="Title"/>
<xsd:element name="Authors" ref="Authors"/>
<xsd:element name="Publisher" ref="Publisher"/>
</xsd:sequence>
<xsd:attribute name="pubCountry" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Title" type="xsd:string"/>
<xsd:element name="Authors">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Author" ref="Author" minOccurs="1"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Author" type="xsd:string"/>
<xsd:element name="Publisher" type="xsd:string"/>
</xsd:schema>
Listing 1.2 W3C XML Schema syntax describing content of Listing 1.1 (Book.xsd).
What Is XML Schema?
XML Schema is the W3C-recommended schema definition language, expressed
in XML 1.0 syntax, which is intended to describe the structure and constrain the
content of documents written in XML. It is explicitly intended to improve on the
schema functionality that was provided by the DTD, which was the original
form of schema for XML documents that the W3C recommended in 1998 when
XML was first released.
6 Chapter 1
The W3C XML Schema became a full W3C recommendation in May 2001.
Unusually, the final recommendation was released in three parts. The first
part, Part 0, is a primer that is intended to introduce XML Schema in a non-
formal way (from W3C’s point of view) and is located at www.w3.org/
TR/2001/REC-xmlschema-0-20010502/. Part 1 is a normative W3C docu-
ment, defines structures that XML Schema supports, and is located at
www.w3.org/TR/2001/REC-xmlschema-1-20010502/. Part 2 is also a norma-
tive W3C document, defines the datatypes that W3C XML Schema supports,
describes mechanisms for creating new datatypes, and is located at
www.w3.org/TR/2001/REC-xmlschema-2-20010502/.
An XSD Schema schema is intended to define the structure and constrain
the content of a class of XML documents. Given the terminology “class,” such
documents are often termed instance documents.
Instance “documents” need not exist as document files but can exist as
a stream of bytes or as a collection of XML Information Set items.
How Does an XML Schema
Processor Work?
In much of this book, we will refer to the relationship between an XSD schema
and instance documents as if an XSD schema-aware validating processor actu-
ally directly processed the instance document. In fact, an XSD schema-aware
processor operates on a set (called the information set) of information items
rather than on the instance document itself. This method is similar to the way
that an XSLT/XPath processor operates, in reality, on a source tree of nodes
rather than directly on the elements in a source XML document. Later in this
chapter, we will take a look at the XML Information Set specification and
examine how the XML Information Set is relevant to XSD Schema.
It isn’t surprising that an XSD Schema processor does not operate directly
on an XML instance document; after all, an instance document is simply a
series of characters. An XML parser extracts a series of logical tokens by pars-
ing the characters in the serialized document. In the case of a parser that is
XML Information Set-aware, the logical tokens are termed information items.
There is, for example, a document information item (broadly corresponding to
the document entity) that has several properties. Among the properties of the
document information item is the [children] property. Note that the name of a
property of an information item, such as the [children] property, is written
enclosed in square brackets. One of the information items in the [children]
property of the document information item is the element information item,
which represents the document element of the instance document.
NOTE
Elementary XML Schema 7
What Is XML Schema for?
The purpose of XML Schema is to define the structure of XML instance docu-
ments. By defining and constraining the content of XML instance documents,
it becomes possible to exchange information between applications with
greater confidence and with less custom programming to test and confirm the
structure of an instance document, or to confirm that the data in a particular
part of the document is of a particular datatype.
XSD Schema adds the capability to combine schemas from more than one
source. For example, we could generate an invoice perhaps by combining a
schema from a customer’s purchase order (which includes information such
as shipping address, billing address, and so on) and billing information from
our own accounts department (describing information such as price, discount
allowed, and so on). This technique would enable schemas to be reused in a
variety of combinations, thus improving efficiency.
XSD Schema Schema Components
The W3C XML Schema Recommendation indicates that an XSD schema com-
prises 13 types of schema components that fall broadly into three groups: pri-
mary, secondary, and helper components.
The XSD Schema Recommendation refers to the following primary components:
■
■ Simple type definitions
■
■ Complex type definitions
■
■ Attribute declarations
■
■ Element declarations
Primary components that are type definitions can have names. Attribute
declarations and element declarations must have names.
The following are the secondary components:
■
■ Attribute group definitions
■
■ Identity-constraint definitions
■
■ Model group definitions
■
■ Notation declarations
The final five XSD Schema components are referred to as helper components
and provide parts of other components:
■
■ Annotations
■
■ Model groups
8 Chapter 1
■
■ Particles
■
■ Wildcards
■
■ Attribute uses
This chapter introduces the syntax to enable you to use many of the compo-
nents just mentioned. Later chapters will detail how they are to be used.
Other Schema Languages for XML
Other schema languages are written in XML and are designed for use in defin-
ing and describing XML instance documents. This book does not describe
them in detail because that is not its intended purpose. You should be aware of
the existence of these other schema languages, however, and where you can
obtain information about them.
XML-Data Reduced, often known simply as XDR, is a schema language that
antedated the XSD Schema language. XDR is routinely used within the
BizTalk Framework (www.biztalk.org) sponsored by Microsoft and is sup-
ported by Microsoft’s MSXML parser.
Another important alternative schema language for XML is now termed
RELAX NG. RELAX NG, standing for RELAX New Generation, is an amal-
gam of two embryonic schema languages, RELAX and TREX. RELAX NG is
being developed by the Organization for Advancement of Structured Information
Standards (OASIS), found at www.oasis-open.org.
These XML schemas are written for XML as well as being written in XML.
The original schema for XML 1.0 was the DTD that was, however, not written
in XML.
The DTD Descended from SGML
The first form of schema for XML documents was the Document Type Defini-
tion. Definitive information about the XML Document Type Definition is con-
tained in the XML 1.0 Recommendation. At the time that XML became a
recommendation, few people envisaged how it would evolve from being a
document description language into one that would be used for many data-
centric, rather than document-centric, applications. Not surprisingly, then, the
DTD created largely with document-centric use in mind was found to have
inadequacies when routinely applied in a data-centric context.
Among the limitations of the DTD are the following:
■
■ Datatyping is very weak.
■
■ DTDs have a limited range of content models.
Elementary XML Schema 9
■
■ The content cannot be validated precisely where it is of mixed content
type.
■
■ Cardinality is limited to being defined to zero, one, or many
occurrences.
■
■ DTDs lack named element or attribute groups that would enable us to
reuse them.
■
■ XSD Schema was designed, among other things, to provide superior
datatyping to the DTD, to provide greater flexibility but yet with
control of content models, and to provide definitions of cardinality not
possible using a DTD.
Later in the chapter, we will look in a little more detail at comparisons
between DTDs and XSD schemas once you have been introduced to some
commonly used XSD Schema constructs.
XSD Schema Tools
You might well already have your own favorite tools with which to create
XML documents and XSD schemas. If so, then feel free to use these as you
work through the examples in this book. The tools mentioned here include
tools that the authors use on an ongoing basis. We are making no specific
claims for their superiority for a particular purpose, but they do enable us to
work with XSD Schema to explore its capabilities and complexities.
Each of the XSD Schema tools is an early implementation; therefore,
you can expect to find some situations where inappropriate error messages are
issued or where an error in a schema is overlooked.
Schema Checkers
At this writing, an online XSD Schema checking service is available using
XML Schema Validator provided at the W3C Web site. The schema validation
service for the May 2001 Recommendation is located at www.w3.org/
2001/03/webdata/xsv. Figure 1.1 shows part of the form that you must use in
order to get a schema validated. Essentially, your schema needs to be accessi-
ble via a URL in order to be validated.
The online checking service can check an XSD schema for validity (that is,
conformity to the W3C Recommendation), or it can validate an instance docu-
ment against a schema.
The online schema checking service can be used to process files that are
accessible at a URL, or you can upload files for checking.
NOTE
10 Chapter 1
Figure 1.1 Online XSD schema validation service from the W3C.
Figure 1.2 shows the form filled in just prior to asking the processor to vali-
date an instance document (Book.xml, Listing 1.1) against its XSD schema
(Book.xsd, Listing 1.2).
Be careful to include the http:// part of the URL; otherwise, the schema
checker interprets the URL as being a relative one, as shown in Figure 1.3. Rel-
ative URLs are not permitted in XSD Schema.
The output from validating Book.xml, using Book.xsd, is shown in Figure
1.4.
XSV is undergoing continuing development. At this writing, not all parts
of the W3C Recommendation are supported. The download page mentioned
earlier provides details of areas not yet fully implemented.
The W3C schema checker requires that you either make the file(s) available
at a URL or upload them by using the online form. If you are unable or unwill-
ing to do that, an alternate approach is to download the schema checker that
lies behind the W3C schema checking service.
Two schema checkers are available for download. One from Henry Thom-
son at the University of Edinburgh (also of the W3C XML Schema Working
Group) is the basis of the W3C schema checking service. The other download
is available from IBM.
NOTE
Elementary XML Schema 11
Figure 1.2 Using the online schema checker.
Figure 1.3 Error message if http:// is omitted.
The download version of XML Schema Validator, XSV, corresponds to the
online schema checking service at W3C. Further information about downloading
XML Schema Validator can be found at www.ltg.ed.ac.uk/~ht/xsv-status.html.
To check the validity of the Book.xsd schema, copy it to the XSV directory
(or place the directory containing Book.xsd in the PATH) and issue the follow-
ing command:
xsv -i Book.xsd
12 Chapter 1
Figure 1.4 The result from the W3C online schema validator when validation has been
successful.
Figure 1.5 Output of validating Book.xsd by using the XSV schema validator.
and you will see output like that in Figure 1.5. Note that there are zero schema
errors.
Elementary XML Schema 13
Alternatively, you can issue the command
xsv -o output.xml -s xsv.xsl -i Book.xsd
And, if you have MSXML3 installed, you will see output similar to the display
of the output file output.xml, as shown in Figure 1.6.
The IBM XML Schema Quality Checker can be downloaded from
www.alphaworks.ibm.com/tech/xmlsqc. The IBM XML Schema Quality
Checker checks whether or not an XSD schema corresponds to the W3C Rec-
ommendation. It does not, at least at this writing, validate instance documents
against the XSD schema.
As well as standalone schema validation tools such as those just described
schemas can be validated by using schema authoring tools.
Schema Authoring Tools
XSD Schemas can be created by using any XML editor, but editors that are not
XSD Schema-aware are limited as learning and production tools. They can
spot basic XML syntax errors and can indicate that the syntax is well-formed,
but are incapable of providing information about the correctness or incorrect-
ness of a schema you have created. Therefore, you would be well-advised to
consider, if you have not already done so, acquiring a schema editor such as
Turbo XML (from TIBCO Extensibility) or XML Spy (from Altova). Both have
free evaluation downloads available from their respective Web sites. Turbo XML
Figure 1.6 Using XSV schema validator and an XSLT stylesheet to generate an output file,
output.xml.
14 Chapter 1
can be downloaded from www.extensibility.com/downloads/trial_down-
loads.htm, and XML Spy can be downloaded from www.xmlspy.com/
.
Turbo XML is available for various flavors of 32-bit Windows operating sys-
tems, multiple flavors of Unix and for Mac OS X. Occasionally version 2.2.1
overlooks schema errors correctly identified by XML Spy.
If you have Turbo XML version 2.2.1 running, you might find that you
cannot start the Netscape 6 browser. If you use Netscape 6, start the browser
before starting Turbo XML.
The generally available version of XML Spy at this writing is version 4.0.
Version 3.5 does not use the final XSD Schema namespace. XML Spy Version 4
supports the full XSD (W3C XML) Schema Recommendation.
XML Spy is generally easy to use. One irritation with XML Spy 4.0 is that it
reformats code, however. For example, it introduces tabs instead of spaces. In
addition, occasional spurious error messages are produced.
Despite the minor problems just mentioned, both Turbo XML and XML Spy
are powerful and useful tools for XSD Schema development. Each is capable
of validating an instance document against a schema as well as validating an
XSD schema for conformity to the W3C XML Schema Recommendation.
XML Schema Document
In this section, we will look briefly at the general structure of an XML Schema
schema such as the one that you saw earlier in Listing 1.2. The description of
each part of a schema document will be brief, and many points will be devel-
oped in greater depth in later chapters.
An XSD Schema document begins, optionally, with an XML declaration with
required version attribute and optional encoding and standalone attributes:
<?xml version="1.0" encoding="UTF-8"?>
Then follows the <xsd:schema> element, which is the element root of all
XSD Schema documents. On the <xsd:schema> element, there is a namespace
declaration for the XSD Schema namespace:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
If you see an XSD schema where the namespace declaration refers to
www.w3.org/2000/10/XMLSchema, that indicates that the schema was created
by using a non-final version of the specification.
<xsd:annotation>
<xsd:documentation>
NOTE
NOTE
T
E
A
M
F
L
Y
Elementary XML Schema 15
This is a sample XML Schema for Chapter 1 of XML Schema Essentials.
</xsd:documentation>
</xsd:annotation>
Optionally, you can include an <xsd:annotation> element nested as above—
within which you can include descriptive information indicating the purpose
of the schema or otherwise documenting it. The content of <xsd:documenta-
tion> elements are intended for use by human readers.
<xsd:element name="Book">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Title" ref="Title"/>
<xsd:element name="Authors" ref="Authors"/>
<xsd:element name="Publisher" ref="Publisher"/>
</xsd:sequence>
<xsd:attribute name="pubCountry" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
An XSD schema will typically include a number of element declarations,
such as the element declaration for the <Book> element shown earlier. In this
example, the <Book> element is to have complex content; that is, either child
elements, an attribute, or both are permitted or required for the <Book> ele-
ment in an instance document. The presence of complex content is indicated
by the <complexType> element. We will return to examine how to define com-
plex types a little later.
<xsd:element name="Title" type="xsd:string"/>
An element declaration can simply associate an element name—in this case,
“Title” with a built-in datatype, in the earlier code, xsd:string.
<xsd:element name="Authors">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Author" ref="Author" minOccurs="1"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Author" type="xsd:string"/>
<xsd:element name="Publisher" type="xsd:string"/>
</xsd:schema>
The final section of the XSD schema contains other element declarations
and is completed by the end tag, </xsd:schema>.
16 Chapter 1
As we move through the chapter, we will examine other foundational struc-
tures in XSD schemas.
Root of an XML Schema Document
The root of all W3C XML Schema documents is the <xsd:schema> element. A
namespace declaration within the <xsd:schema> element associates it with
the W3C XML Schema namespace:
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
Of course, if you are using the xsd prefix, then a namespace declaration is
essential if the namespace prefix is to conform to the requirements of the
Namespaces in XML Recommendation and to be processed by applications
that implement that recommendation.
You might also see the namespace prefix xs associated with the W3C XML
Schema namespace.
Declaring the Location of Your XML
Schema Document
The instance document that you saw in Listing 1.1 made no reference to being
associated with any particular schema. There is no direct equivalent to the
DTD of XML 1.0. XSD Schema uses a more indirect approach.
For the moment, we will look at how we associate an instance document
that does not use namespaces with an applicable schema document. Listing
1.3 shows how this job can be done.
<?xml version="1.0"?>
<Book pubCountry="USA"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:My WritingXML Schema
EssentialsCh01Book.xsd">
<Title>XML Schema Essentials</Title>
<Authors>
<Author>R. Allen Wyke</Author>
<Author>Andrew Watt</Author>
</Authors>
<Publisher>John Wiley</Publisher>
</Book>
Listing 1.3 Instance document that does not use namespaces (Book02.xml).
Elementary XML Schema 17
The association of an instance document is a two-stage process. The name-
space declaration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
associates the namespace prefix xsi with the URI shown. The xsi:noName-
spaceSchemaLocation attribute, which belongs to the namespace
http://www.w3.org/2001/XMLSchema-instance
indicates the location of the schema. The xsi:noNamespaceSchemaLocation
attribute can only be used when the xsi namespace prefix has been declared.
The value of the noNamespaceSchemaLocation attribute indicates the location
of the schema. In the case of this example, the schema is located on drive C: at
the location indicated:
C:My WritingXML Schema EssentialsCh01Book.xsd
XSD Schema processors are free to ignore or to override the schema sug-
gested by using the mechanism just described.
Declaring Elements and Defining Types
Because XML instance documents contain one (and typically many more) ele-
ment(s), one of the foundational techniques of W3C XML Schema is the decla-
ration of elements.
In XML Schema, there is a substantive difference between declaring an ele-
ment that has content that is either a simple type or complex type and is per-
mitted to occur in an instance document and defining a new type, which can be
either simple type or complex type.
The terms definition and declaration in XML Schema have no close
relation to the terms Document Type Definition and Document Type Declaration
of XML 1.0.
First, let’s look at how we declare an element the content of which is of sim-
ple type in an instance document.
Defining Simple Types
Elements that contain other elements or that possess attributes are termed
complex types, and we will discuss them in the next section. Elements that have
NOTE
18 Chapter 1
neither child elements nor possess attributes are termed simple types, and we
will discuss these in this section. All attributes have simple type content.
XSD Schema provides three flavors of simple types:
1. Atomic types
2. List types
3. Union types
Each of these is discussed in the paragraphs that follow. XSD Schema sim-
ple types will be discussed in detail in Chapter 4, “Applying Datatypes.”
Simple types can be either those simple types, such as xsd:string, built into
the XML Schema language or can be simple types created by a schema author
by using techniques which we will describe later. All simple types created by a
schema author are derived datatypes. Those datatypes built into XSD Schema
include both primitive datatypes and derived datatypes. Those datatypes are
fully described in Part 2 of the W3C XML Schema Recommendation.
Atomic (Simple) Types
Let’s assume that we wanted to describe the title and authors of this book in
XML. A first, crude attempt at an instance document might look like the fol-
lowing (SimpleBook01.xml).
As you can see, the structure of the document is poor, but a schema for such
an instance document could be created by only declaring a single element of
simple type, as shown in Listing 1.5 (SimpleBook01.xsd). This code declares an
element <Book> whose type is one of the built-in primitive types of XSD
Schema, xsd:string.
<?xml version='1.0'?>
<Book>
XML Schema Essentials, R. Allen Wyke, Andrew Watt, Wiley, USA
</Book>
Listing 1.4 A first attempt at an instance document (SimpleBook01.xml).
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:element name="Book" type="xsd:string"/>
</xsd:schema>
Listing 1.5 A schema for Listing 1.4 (SimpleBook01.xsd).
Elementary XML Schema 19
You will recognize the XML declaration and the <xsd:schema> element. To
declare an element with simple type content, we simply use an <xsd:ele-
ment>. The name attribute and the type attribute on the <xsd:element> serve
to associate the element type name of the <Book> element in an instance docu-
ment and its permitted datatype, xsd:string. We will go on to further develop
the structure of an instance document later in the chapter.
From the point of view of XSD Schema, an atomic simple type is indivisible.
An xsd:string, as far as XSD Schema is concerned, cannot be split into simpler
types. Such indivisibility applies to both in-built simple types and to derived
simple types.
Let’s suppose that we have a European-based e-commerce operation that
sells to the United Kingdom, France, and Germany only. The shipping address
part of an invoice or purchase order might look like Listing 1.6.
A schema for the code from Listing 1.6 is shown in Listing 1.7. The point of
interest relating to atomic simple types relates to the <xsd:simpleType
name=”CountryType”> element towards the end of the following schema.
In the declaration for the <CountryType> element, we indicate that the
datatype is a named type that is defined by using the <xsd:simpleType> ele-
ment. The value of the CountryType contained in the <Country> element in
the instance document is “DE”, meaning Deutschland (Germany). This type is
atomic because we cannot take one of its constituent letters and maintain
some of the meaning. The meaning is related to the two-letter code for Ger-
many in this example.
List (Simple) Types
A list type in XSD Schema is made up of a sequence of atomic types. There are
no built-in list types in XSD Schema, so we must define a list type if we wish to
<ShippingAddress type="EUAddress">
<Name>
<FirstName>Hans</FirstName>
<LastName>Schmidt</LastName>
</Name>
<Address>
<Street>123 Hallgarten</Street>
<City>Berlin</City>
<PostalCode>12345</PostalCode>
<Country>DE</Country>
</Address>
</ShippingAddress>
Listing 1.6 Shipping address part of invoice (ShippingAddress.xml).
20 Chapter 1
<?xml version='1.0'?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="ShippingAddress">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="NameType"/>
<xsd:element name="Address" type="AddressType"/>
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="NameType">
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string"/>
<xsd:element name="LastName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="AddressType">
<xsd:sequence>
<xsd:element name="Street" type="xsd:string"/>
<xsd:element name="City" type="xsd:string"/>
<xsd:element name="PostalCode" type="PostalCodeType"/>
<xsd:element name="Country" type="CountryType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="PostalCodeType">
<xsd:restriction base="xsd:integer">
<xsd:length value="5" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="CountryType">
<xsd:restriction base="xsd:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
Listing 1.7 A schema for Listing 1.7 (ShippingAddress.xsd).
use one. For example, we could define a list type called SouthEastStatesType,
which is a list type consisting of the values “FL LA GA SC.” The list type has
four string values (each of which happens to be two characters long) that are
separated by a space.
Elementary XML Schema 21
So, we could have an element <SouthEastStates> as follows:
<SouthEastStates>FL LA GA SC</SouthEastStates>
This element uses the SouthEastStatesType simple type. If we wanted to
define a new simple type, we could use the following code:
<xsd:simpleType name="SouthEastStatesType">
<xsd:list itemType="xsd:string"/>
</xsd:simpleType>
A simple instance document is shown in Listing 1.8.
An XSD schema for Listing 1.8 is shown in Listing 1.9.
The <xsd:element> element is the declaration that associates the <SouthEast-
States> element with the datatype SouthEastStatesType. The <xsd:simple-
Type> element is the definition of the datatype SouthEastStatesType. In order
to create a list simple type, we need to nest an <xsd:list> element within the
<xsd:simpleType> element. The base type for a list is known as its itemType.
It is possible to define list types based on the xsd:string type. The
xsd:string type might contain space characters or other whitespace characters,
however, which are the separators for the individual items in a list type. So, you
NOTE
<?xml version='1.0'?>
<SouthEastStates>
FL LA GA SC
</SouthEastStates>
Listing 1.8 Simple instance document for four southeastern states (SouthEastern-
States.xml).
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:element name="SouthEastStates" type="SouthEastStatesType"/>
<xsd:simpleType name="SouthEastStatesType">
<xsd:list itemType="xsd:string"/>
</xsd:simpleType>
</xsd:schema>
Listing 1.9 A schema for Listing 1.8 (SouthEasternStates.xsd).
22 Chapter 1
should be careful when attempting to use the xsd:string type as the base type
for a list simple type.
Let’s look briefly at the kind of problems that can arise when using strings
that include whitespace. For example, if we had a simple list datatype
NorthAmericanCountriesType defined as follows,
<xsd:simpleType name="NorthAmericanCountriesType">
<xsd:list itemType="xsd:string"/>
</xsd:simpleType>
and we had an element, <NorthAmericanCountries>, which used the NorthAmer-
icanCountriesType datatype with content like the following,
<NorthAmericanCountries>United States of America Canada
Mexico</NorthAmericanCountries>
this code would be treated in XSD Schema as a list of six items, not as three
countries as you might expect. The first item in the list would be the string
“United,” followed by a whitespace character. The second item in the list
would be “States,” again separated from the third item, “of,” by a whitespace
character (and so on). To avoid this type of problem, avoid the use of spaces if
you are using the xsd:string datatype, or use more appropriate datatypes as
list members. Simple datatypes are discussed further in Chapter 4.
Union (Simple) Types
Union datatypes are always derived datatypes. In XSD Schema, there are no
built-in union datatypes. The maxOccurs attribute uses a union simple
datatype, however, as shown in the following code snippet:
<xsd:attribute name="maxOccurs">
<xsd:simpleType>
<xsd:union>
<xsd:simpleType>
<xsd:restriction base='xsd:nonNegativeInteger'/>
</xsd:simpleType>
<xsd:simpleType>
<xsd:restriction base='xsd:string'>
<xsd:enumeration value='xsd:unbounded'/>
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
</xsd:attribute>
Elementary XML Schema 23
The permitted values of the maxOccurs attribute are any non-negative inte-
ger (in other words, any value of type of xsd:nonNegativeInteger) unioned
with the string value of “unbounded.”
A union datatype has memberTypes. In the example you have just seen for
the maxOccurs attribute, the memberTypes are xsd:nonNegativeInteger and
the anonymous datatype derived from xsd:string by restriction.
The default evaluation of memberTypes is that they are evaluated in the
order given in the schema. Evaluation ceases once a first matching member-
Type is found. The order of evaluation can be overridden by the xsi:type
attribute.
Having looked at how we can define the available simple types and use
them in element declarations, let’s move on to look at the situation where an
element might have simple type content but also possesses an attribute.
Simple Type Content and an Attribute
Strictly speaking, we are straying into the territory of complex types—because
in XSD Schema terminology, an element possesses an attribute that by defini-
tion makes it a complex type in XSD Schema. Thus, if we wanted to create an
element that would reflect a selling price for a particular locality, perhaps
including local sales tax (Value Added Tax in the European Union, for exam-
ple), we would need to be able to create an element like the following:
<UKPrice currency="GBP">199.99</UKPrice>
The content of the <UKPrice> element is simply of xsd:decimal type. To
express that notion, we can use the <xsd:simpleContent> element and then
use the <xsd:extension> element with the base type xsd:decimal within which
we nest an <xsd:attribute> element to define the currency attribute:
<xsd:element name="UKPrice">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:decimal">
<xsd:attribute name="currency" type="xsd:string"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
What we have done with this fairly verbose syntax is to derive a new com-
plex type from the built-in simple type of xsd:decimal. The <xsd:complex-
Type> element is anonymous, but a named complex type could have been
24 Chapter 1
used if, for example, similar prices in local currency were to be added for a
number of European Union countries.
If we apply this scenario to our simple book instance document so that it
has a PubCountry attribute of the <Book> element, we see the result in Listing
1.10.
Adding the PubCountry attribute means that the content of <Book> element
is now of complex type. Listing 1.11 shows a schema to describe our modified
instance document.
As you can see, the mechanism of adding a single attribute to an element
that has simple type content is pretty verbose in XSD Schema. If you follow
the nesting within the <xsd:element>, you should grasp the logic. Because an
attribute is present, the content in XSD Schema is complex type; therefore, we
use the <xsd:complexType> element. The content of the <Book> element is a
simple datatype, and therefore we use the <xsd:simpleContent> element. As
well as the simple type content, however, an attribute is also present. Thus, the
simple type content is extended, which is shown by the presence of the
<xsd:extension> element. The specific nature of the extension is an attribute
signaled by the presence of an <xsd:attribute> element nested within the
<xsd:extension> element.
<?xml version='1.0'?>
<Book PubCountry="USA">
XML Schema Essentials, R. Allen Wyke, Andrew Watt, Wiley
</Book>
Listing 1.10 Adding an attribute to the <Book> element (SimpleBook02.xml).
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:element name="Book">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="PubCountry" type="xsd:string"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Listing 1.11 A schema to reflect the added PubCountry attribute (SimpleBook02.xsd).
T
E
A
M
F
L
Y
Elementary XML Schema 25
This example is a special case of a complex type. Let’s move on to introduce
how to define complex types.
Defining Complex Types
In the terminology of XML Schema, an element that either has child elements
(sometimes called subelements) or that possesses attributes is termed a com-
plex type. A type that possesses neither child elements nor attributes is termed
a simple type.
A complex type definition will typically contain one or more element decla-
rations, element references, and/or attribute declarations. Elements are
declared by using the <xsd:element> element, and attributes are declared by
using the <xsd:attribute> element.
A declaration, whether of an element or of an attribute, is not (strictly
speaking) a type but is an association between a name and a set of constraints
on the appearance of that name in the XML document governed by the rele-
vant schema that contains the name.
XSD Schema provides mechanisms for us to define anonymous and
named complex types. First, let’s take a look at how we define anonymous
complex types.
Anonymous Complex Types
Anonymous complex types, as you might guess, are complex types that have
no name. In creating an anonymous complex type, typically an <xsd:complex-
Type> element will be nested within an <xsd:element> element.
For example, in an invoice we might typically specify each line item which
was purchased and which is being billed. Listing 1.12 shows a simplified
invoice.
The schema that corresponds to SimpleInvoice.xml is shown in Listing 1.13.
The schema contains both anonymous and named complex types, but we will
focus on the anonymous types in the meantime.
The declaration for the <SimpleInvoice> element has nested within it the
definition of an anonymous complex type as shown here:
<xsd:element name="SimpleInvoice">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Customer" type="CustomerType"/>
<xsd:element name="LineItems" type="LineItemsType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
26 Chapter 1
<?xml version='1.0'?>
<SimpleInvoice>
<Customer>
<CustomerName>XMML.com</CustomerName>
</Customer>
<LineItems>
<LineItem quantity="2">Mandrake Linux version 8</LineItem>
<LineItem quantity="1">IBM WebSphere Studio Workbench version
4</LineItem>
</LineItems>
</SimpleInvoice>
Listing 1.12 A simple invoice (SimpleInvoice.xml).
Notice that we declare an element named “SimpleInvoice.” We define the
type for a <SimpleInvoice> element in an anonymous complex type by means
of a nested anonymous <xsd:complexType> element; that is, an <xsd:com-
plexType> element that lacks a name attribute. The complex type is defined by
means of an <xsd:sequence> element as a sequence of <Customer> and
<LineItems> elements.
The declaration of the <LineItem> element also contains an anonymous
complex type definition. You will perhaps recognize this definition as similar
to the book example shown in Listing 1.11. The <LineItem> element, too, has a
single attribute and xsd:string content.
Named Complex Types
You have seen the anonymous complex type demonstrated. In many uses of
XML documents, however, you might well want to use a complex type more
than once, for two different purposes, in the same XML document. In an
invoice or purchase order, for example, you might want to define and/or
declare a complex type for an address structure that can be used both for the
billing address and the shipping address. There is unlikely to be any useful
purpose served by creating two separate but essentially identical address
structures. Reuse of type definitions makes practical sense.
XML Schema enables us to create complex types that can be used in the
same XML document for more than one purpose by means of the named com-
plex type.
If you are creating an invoice or purchase order, you are likely to include
addresses for the purchaser and the billing party. To create a complex type that
would describe such an address, you could use code like that in Listing 1.14.
Elementary XML Schema 27
<?xml version='1.0'?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="SimpleInvoice">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Customer" type="CustomerType"/>
<xsd:element name="LineItems" type="LineItemsType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="CustomerType">
<xsd:sequence>
<xsd:element name="CustomerName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="LineItemsType">
<xsd:sequence>
<xsd:element ref="LineItem" minOccurs="1"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="LineItem">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="quantity" type="xsd:string"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Listing 1.13 A schema for Listing 1.12 (SimpleInvoice.xsd).
The <xsd:complexType> element contains the information that defines the
complex type named “USAddressType.” The element content is defined as a
sequence (note the <xsd:sequence> element) of elements with element type
names of Name, Street, City, State, and Zip—each having simple type content.
We will see in Chapter 8, “Deriving Types,” how we can create new datatypes
that constrain the content of the <State> and <Zip> elements to appropriate
28 Chapter 1
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<!-- NOTE - This is NOT a complete schema! -->
<xsd:element name="BillingAddress" type="USAddressType"/>
<xsd:element name="ShippingAddress" type="USAddressType"/>
<xsd:complexType name="USAddressType" >
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="Street" type="xsd:string"/>
<xsd:element name="City" type="xsd:string"/>
<xsd:element name="State" type="xsd:string"/>
<xsd:element name="Zip" type="xsd:decimal"/>
</xsd:sequence>
<xsd:attribute name="country" type="xsd:NMTOKEN" fixed="USA"/>
</xsd:complexType>
</xsd:schema>
Listing 1.14 A partial schema with a named complex type (USAddress.xsd).
derived datatypes. The <xsd:attribute> element indicates the presence on an
element of USAddressType of a country attribute.
Notice that there are two element declarations declared to be of type USAd-
dressType: the declarations for the <BillingAddress> element and the <Ship-
pingAddress> element. The type attribute of the <xsd:element> references the
appropriate named complex type.
Notice that the type of the country attribute is “xsd:NMTOKEN,” which has
a fixed value of “USA.” An xsd:NMTOKEN is a derived datatype that is derived
from the datatype xsd:token (all lower case). The token derived datatype is
itself derived from the normalizedString derived data type. In XML Schema
terminology, normalizedString is said to be the base type of token.
Let’s get a little more into the jargon of XML Schema. The xsd:token derived
type has the value space that is the set of strings that does not contain a line feed
(character #xA) or a tab (character #x9), nor is there any leading space or a
sequence of two or more spaces within the string. The xsd:NMTOKEN type
constrains the allowed characters further because all whitespace characters
are disallowed.
The NMTOKEN attribute type is defined in the XML 1.0 (Second Edition)
Recommendation.
NOTE
Elementary XML Schema 29
If you wanted to further refine the definition of the USAddressType complex
type, you might want to ensure that you only allow five-digit zip codes. You
could go partway toward achieving that goal by using the code shown here:
<xsd:element name="Zip" type="xsd:decimal" minLength="5" maxLength="5"/>
Two named complex types are shown in Listing 1.13 which you saw earlier.
The complex datatypes CustomerType and LineItemsType are used in the type
attributes of the declaration of the <Customer> element and the <LineItems>
element.
We can use complex type definitions to add more structure to the simple
book example. Listing 1.15 shows a further refinement of the structure of the
instance document.
You might instantly recognize the content of the <Book> element as being a
complex type. We can use an XSD schema as shown in Listing 1.16 to describe
the instance document.
The schema demonstrates several of the kinds of declarations and defini-
tions that you have already seen. The <Book> element is of complex type and
makes use of an anonymous complex type definition. The <Title>, <Author>,
and <Publisher> elements use element declarations that use the predefined
xsd:string simple type. The definition of the <Authors> element again uses an
anonymous complex type definition.
Using Anonymous or Named
Complex Types
You might already have grasped the issues involved with choosing when to
use an anonymous complex type or a named complex type, but these will be
briefly summarized here. There is no rule that says you must use either an
anonymous or named complex type in any particular situation. Whether you
<?xml version="1.0"?>
<Book pubCountry="USA">
<Title>XML Schema Essentials</Title>
<Authors>
<Author>R. Allen Wyke</Author>
<Author>Andrew Watt</Author>
</Authors>
<Publisher>John Wiley</Publisher>
</Book>
Listing 1.15 Adding element content to the simple book (SimpleBook03.xml).
30 Chapter 1
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:annotation>
<xsd:documentation>
This is a sample XML Schema for Chapter 1 of XML Schema
Essentials.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="Book">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Title" ref="Title"/>
<xsd:element name="Authors" ref="Authors"/>
<xsd:element name="Publisher" ref="Publisher"/>
</xsd:sequence>
<xsd:attribute name="PubCountry" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Title" type="xsd:string"/>
<xsd:element name="Authors">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Author" ref="Author" minOccurs="1"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Author" type="xsd:string"/>
<xsd:element name="Publisher" type="xsd:string"/>
</xsd:schema>
Listing 1.16 A schema containing simple and complex types (SimpleBook03.xsd).
use an anonymous complex type or a named complex type is a matter of con-
venience and efficiency.
If you plan to use a structure more than once in an instance document—for
example, an address structure in both the billing address and shipping
address part of an invoice—then it makes sense to avoid duplication of decla-
rations, declare a named complex type once, and then reference it twice by
using the type attribute of the <xsd:element> element.
Elementary XML Schema 31
In Chapter 10, “Bringing the Parts Together,”we will look at how we can reuse
derived types from other schema documents. In order to be able to reference those
type definitions, they must be named.As you will see later, we can also import ele-
ment declarations that always include a name attribute on the <xsd:element>.
If you plan to use a structure only once, then you need to define the structure
once in any case. If you have no plans to use that structure on multiple occa-
sions in an instance document, then little useful purpose is served by naming
the complex type, declaring it globally, and then referencing it by name. In that
situation, you would almost certainly use an anonymous complex type.
Mixed Content
You might be aware that when using a DTD (which defines a mixed content
model), little worthwhile validation can be carried out on an instance docu-
ment. The instance document, or a selected part of it that contains mixed con-
tent, is allowed to contain both elements and character content—but the DTD
cannot say anything about which elements are to be allowed in the mixed con-
tent, what order they might be in, or whether there should be any restrictions
on where character content is to be allowed. XSD Schema can improve signifi-
cantly on what is a significant weakness of the DTD.
Let’s suppose that we want routinely to send out a letter to customers, cre-
ated from XML, which thanks the customer for an order, details the items pur-
chased, and informs the customer of any special offers that we might have
available at the time that the letter is sent. An outline of a possible instance
document might look like that in Listing 1.17.
A full version showing mixed content is shown in Listing 1.18. We needn’t
concern ourselves with where, from, or how the information contained in the
document was assembled; rather, we simply accept it as an approximation of
a finished document.
If we were using a DTD as a schema for our instance document, we could
say little more than that mixed content was to be allowed. XSD Schema gives
<?xml version='1.0'?>
<CustomerLetter>
<CustomerAddress></CustomerAddress>
<Salutation></Salutation>
<Thanks></Thanks>
<ItemsOrdered></ItemsOrdered>
<SpecialOffers></SpecialOffers>
</CustomerLetter>
Listing 1.17 The skeleton of a customer letter (CustomerLetter01.xml).
32 Chapter 1
<?xml version='1.0'?>
<CustomerLetter>
<CustomerAddress>
<Customer>Siegried Idylls</Customer>
<Street>WagnerStrasse 88</Street>
<City>Bayreuth</City>
<Country>Germany</Country>
</CustomerAddress>
Dear <Salutation>Richard</Salutation>,
<Thanks>XMML.com is grateful to you for the order detailed
below and hope that all parts of the order will prove
satisfactory.</Thanks>
<ItemsOrdered>
<Item quantity="2">Some item</Item>
<Item quantity="4">Some other item</Item>
</ItemsOrdered>
We would like to introduce you to some special offers we are currently
making available to selected customers only.
<SpecialOffers>
<SpecialOffer specialPrice="99">Some great bargain</SpecialOffer>
<SpecialOffer specialPrice="250">Some other great
bargain</SpecialOffer>
</SpecialOffers>
These very special offers are available only until October 31st, so if
you want to take
advantage of these contact us immediately to secure this special
pricing.
</CustomerLetter>
Listing 1.18 An instance document illustrating the customer letter (CustomerLetter02.xml).
us significantly more control over element content and ordering. Listing 1.19
shows an XSD Schema for the customer letter.
The key part of the schema, as far as understanding how to control mixed con-
tent by using XSD Schema, is the declaration of the <CustomerLetter> element:
<xsd:element name="CustomerLetter" >
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="CustomerAddress" type="CustomerAddressType"/>
<xsd:element name="Salutation" type="xsd:string"/>
<xsd:element name="Thanks" type="xsd:string"/>
<xsd:element name="ItemsOrdered" type="ItemsOrderedType"/>
<xsd:element name="SpecialOffers" type="SpecialOffersType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Elementary XML Schema 33
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:element name="CustomerLetter" >
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="CustomerAddress" type="CustomerAddressType"/>
<xsd:element name="Salutation" type="xsd:string"/>
<xsd:element name="Thanks" type="xsd:string"/>
<xsd:element name="ItemsOrdered" type="ItemsOrderedType"/>
<xsd:element name="SpecialOffers" type="SpecialOffersType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="CustomerAddressType">
<xsd:sequence>
<xsd:element name="Customer" type="xsd:string"/>
<xsd:element name="Street" type="xsd:string"/>
<xsd:element name="City" type="xsd:string"/>
<xsd:element name="Country" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ItemsOrderedType">
<xsd:sequence>
<xsd:element name="Item" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="quantity" type="xsd:decimal"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SpecialOffersType">
<xsd:sequence>
<xsd:element name="SpecialOffer" minOccurs="2"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="specialPrice" type="xsd:decimal"/>
</xsd:extension>
Listing 1.19 An XSD Schema for the customer letter (CustomerLetter02.xsd).
continues
Random documents with unrelated
content Scribd suggests to you:
reelected the infant Frederick. The contention continued between
the rival candidates, with repeated elections. Otho, by flattering the
clergy, obtained himself to be crowned at Rome, and assumed the
title of Otho IV.; but some of his followers having been killed by the
Roman citizens he meditated revenge, and instead of returning to
Germany, reconquered certain possessions usurped from the empire
by the pope. For this violence Otho was excommunicated by the holy
father, who turned his influence in behalf of the youthful Frederick,
and procured him to be elected emperor instead. Otho had a quarrel
with Philip Augustus, king of France, respecting an old wager
between them. Philip, neither believing nor wishing that Otho could
attain the imperial dignity, had wagered the best city in his kingdom
against whichever he should select of Otho’s baggage horses, if he
carried his point. After Otho had achieved it, he seriously demanded
the city of Paris from Philip, who quite as seriously refused to deliver
up his capital. War ensued, and in the decisive battle of Bovines,
called the “battle of the spurs,” from the number of knights who
perished, Philip defeated Otho at the head of two hundred thousand
Germans. The imperial dragon, which the Germans, in their wars,
were accustomed to plant on a great armed chariot with a guard
chosen from the flower of the army, fell into the hands of the victors,
and the emperor himself barely escaped at the hazard of his life.
This battle was fought in August, 1215; and Otho, completely
vanquished, retreated upon his devotions, and died in 1218, without
issue.[31]
The wager, in its consequences so disastrous to the Germans,
and so illustrious to the French arms, was made with Philip while
Otho was passing through France on his way from the court of
England. Collectors of “engraved British portraits,” and the portraits
of persons who “come into England,” should look to this. How many
illustrated “Grangers” are there with a portrait of Otho IV., earl of
York?
THE DUKES OF YORK.
I.
Edmund Plantagenet, surnamed De Langley, from his birth-place,
fifth son of king Edward III., was first created earl of Cambridge by
his father, and afterwards created duke of York by his nephew,
Richard II. He was much influenced by his brother, the duke of
Gloucester; and an historian of the period calls him “a soft prince.” It
is certain that he had few stirring qualities, and that passive virtues
were not valued in an age when they were of little service to
contending parties. In 1402, three years after the accession of Henry
IV., he died at his manor of Langley, and was interred in the priory
there.
II.
Edward Plantagenet, second duke of York, was son of the first
duke, grandson to Edward III., and great uncle to Henry V., by
whose side he valiantly fought and perished, in the field of
Agincourt, October 25, 1415.
III.
Richard Plantagenet, third duke of York, nephew of the second
duke, and son of Richard earl of Cambridge, who was executed for
treason against Henry V., was restored to his paternal honours by
Henry VI., and allowed to succeed to his uncle’s inheritance. As he
was one of the most illustrious by descent, so he became one of the
most powerful subjects through his dignities and alliances. After the
death of the duke of Bedford, the celebrated regent of France, he
was appointed to succeed him, and with the assistance of the
valorous lord Talbot, afterwards earl of Shrewsbury, maintained a
footing in the French territories upwards of five years. The incapacity
of Henry VI. incited him to urge his claim to the crown of England in
right of his mother, through whom he descended from Philippa, only
daughter of the duke of Clarence, second son to Edward III.;
whereas the king descended from the duke of Lancaster, third son of
that monarch. The duke’s superiority of descent, his valour and
mildness in various high employments, and his immense
possessions, derived through numerous successions, gave him
influence with the nobility, and procured him formidable connections.
He levied war against the king, and without material loss slew about
five thousand of the royal forces at St. Alban’s, on the 22d of May,
1452. This was the first blood spilt in the fierce and fatal quarrel
between the rival houses of York and Lancaster, which lasted thirty
years, was signalized by twelve pitched battles, cost the lives of
eighty princes of the blood, and almost annihilated the ancient
nobility of England. After this battle, the duke’s irresolution, and the
heroism of Margaret, queen of Henry VI., caused a suspension of
hostilities. The leaders on both sides assented to meet in London,
and be solemnly reconciled. The duke of York led the queen in
solemn procession to St. Paul’s, and the chiefs of one party marched
hand in hand with the chiefs of the other. It was a public
demonstration of peace, with secret mutual distrust; and an accident
aroused the slumbering strife. One of the king’s retinue insulted one
of the earl of Warwick’s; their companions fought, and both parties
in every county flew to arms. The battle of Bloreheath, in
Staffordshire, 23d September, 1459, was won by the Lancastrians. At
the battle of Northampton, 10th July, 1560, the Yorkists had the
victory, and the king was taken prisoner. A parliament, summoned in
the king’s name, met at Westminster, which the duke of York
attended; and, had he then seated himself on the throne in the
House of Lords, the deadly feud might have been ended by his being
proclaimed king; but his coolness and moderation intimidated his
friends, and encouraged his enemies. His personal courage was
undoubted, but he was deficient in political courage. The parliament
deliberated, and though they declared the duke’s title indefeasible,
yet they decided that Henry should retain the crown during life.
They provided, however, that till the king’s decease the government
should be administered by the duke, as the true and lawful heir of
the monarchy; and in this arrangement Richard acquiesced.
Meanwhile, queen Margaret, with her infant son, appealed to the
barons of the north against the settlement in the south, and
collected an army with astonishing celerity. The duke of York
hastened with five thousand troops to quell what he imagined to be
the beginning of an insurrection, and found, near Wakefield, a force
of twenty thousand men. He threw himself into Sandal castle, but
with characteristic bravery, imagining he should be disgraced by
remaining between walls in fear of a female, he descended onto the
plain of Wakefield on the 24th of December, and gave battle to the
queen, who largely outnumbering his little army, defeated and slew
him; and his son, the earl of Rutland, an innocent youth of
seventeen, having been taken prisoner, was murdered in cold blood
by the lord de Clifford. Margaret caused the duke’s head to be cut
off, and fixed on the gates of the city of York, with a paper crown on
it in derision of his claim. He perished in the fiftieth year of his age,
worthy of a better fate.
IV.
Edward Plantagenet, fourth duke of York, eldest son of the last,
prosecuted his father’s pretensions, and defeated the earl of
Pembroke, half brother to Henry VI., at Mortimer’s Cross, in
Herefordshire. Shortly afterwards, queen Margaret advanced upon
London, and gained a victory over the Yorkists under the earl of
Warwick, at the second battle of St. Alban’s, and, at the same time,
regained possession of the person of her weak husband. Pressed by
the Yorkists, she retreated to the north and the youthful duke,
remarkable for beauty of person, bravery, affability, and every
popular quality, entered the capital amidst the acclamations of the
citizens. Elated by his success, he resolved to openly insist on his
claim, and treat his adversaries as rebels and traitors. On the 3d of
March, 1460, he caused his army to muster in St. John’s Fields,
Clerkenwell; and after an harangue to the multitude surrounding his
soldiery, the tumultuary crowd were asked whether they would have
Henry of Lancaster, or Edward, eldest son of the late duke of York,
for king. Their “sweet voices” were for the latter; and this show of
popular election was ratified by a great number of bishops, lords,
magistrates, and other persons of distinction, assembled for that
purpose at Baynard’s Castle. On the morrow, the duke went to St.
Paul’s and offered, and had Te Deum sung, and was with great
royalty conveyed to Westminster, and there in the great hall sat in
the king’s seat, with St. Edward’s sceptre in his hand. On the 29th of
March, 1461, he fought the fierce and bloody battle of Touton,
wherein he issued orders to give no quarter, and there were above
thirty-six thousand slain. This slaughter confirmed him king of
England, and he reigned upwards of twenty years under the title of
Edward IV., defiling his fame and power by effeminacy and cruelty.
The title of York merged in the royal dignity.
V.
Richard Plantagenet, of Shrewsbury, fifth duke of York, son of
Edward IV., was murdered in the tower while young, with his elder
brother, Edward V., by order of their uncle, the duke of Gloucester,
afterwards Richard III.
VI.
Henry Tudor, sixth duke of York, was so created by his father
Henry VII., whom he succeeded as king, under the title of Henry
VIII., and stained our annals with heartless crimes.
VII.
Charles Stuart, seventh duke of York, was second son of James
I., by whom he was created to that title in 1604, and whom he
succeeded in the throne as Charles I.
VIII.
James Stuart, a younger son of Charles I., was the eighth duke of
York. While bearing this title during the reign of his brother Charles
II., he manifested great personal courage as a naval commander, in
several actions with the Dutch. Under the title of James II., he
incompetently filled the throne and weakly abdicated it.
IX.
Ernest Augustus Guelph, ninth duke of York, duke of Albany, earl
of Ulster, and bishop of Osnaburgh, was brother to George Lewis
Guelph, elector of Hanover, and king of England as George I., by
letters from whom, in 1716, he was dignified as above, and died in
1728, unmarried.
X.
Edward Augustus, tenth duke of York, duke of Albany, and earl of
Ulster, was second son of Frederick prince of Wales, and brother to
king George III., by whom he was created to those titles. He died at
Monaco, in Italy, September 17, 1767, unmarried.
XI.
THE LATE DUKE OF YORK.
Frederick, eleventh Duke of York, was brother of His Majesty King
George IV., and second son of his late Majesty King George III., by
whom he was advanced to the dignities of Duke of the Kingdom of
Great Britain, and of Earl of the Kingdom of Ireland, by the titles of
Duke of York and of Albany in Great Britain, and of Earl of Ulster in
Ireland, and presented to the Bishopric of Osnaburgh. His Royal
Highness was Commander-in-Chief of all the Land Forces of the
United Kingdom, Colonel of the First Regiment of Foot Guards,
Colonel-in-chief of the 60th Regiment of Infantry, Officiating Grand
Master of the Order of the Bath, High Steward of New Windsor,
Warden and Keeper of the New Forest Hampshire, Knight of the
Garter, Knight of the Order of the Holy Ghost in France, of the Black
Eagle in Russia, the Red Eagle in Prussia, of St. Maria Theresa in
Austria, of Charles III. in Spain, Doctor of Civil Law, and Fellow or
the Royal Society.
The late duke of York was born on the 16th of August, 1763; he
died on the 5th of January, 1827. A few miscellaneous memoranda
are extracted from journals of the dates they refer to.
The duke of York was sent to Germany to finish his education.
On the 1st of August, 1787, his royal highness, after having been
only five days on the road from Hanover to Calais, embarked at that
port, on board a common packet-boat, for England, and arrived at
Dover the same afternoon. He was at St. James’s-palace the
following day by half-past twelve o’clock; and, on the arrival of the
prince of Wales at Carlton-house, he was visited by the duke, after
an absence of four years, which, far from cooling, had increased the
affection of the royal brothers.
On the 20th of December, in the same year, a grand masonic
lodge was held at the Star and Garter in Pall-mall. The duke of
Cumberland as grand-master, the prince of Wales, and the duke of
York, were in the new uniform of the Britannic-lodge, and the duke
of York received another degree in masonry; he had some time
before been initiated in the first mysteries of the brotherhood.
On the 5th of February, 1788, the duke of York appeared in the
Court of King’s Bench, and was sworn to give evidence before the
grand jury of Middlesex, on an indictment for fraud, in sending a
letter to his royal highness, purporting to be a letter from captain
Morris, requesting the loan of forty pounds. The grand jury found
the indictment, and the prisoner, whose name does not appear, was
brought into court by the keeper of Tothill-fields Bridewell, and
pleaded not guilty, whereupon he was remanded, and the indictment
appointed to be tried in the sittings after the following term; but
there is no account of the trial having been had.
In December of the same year, the duke ordered two hundred
and sixty sacks of coals to be distributed among the families of the
married men of his regiment, and the same to be continued during
the severity of the weather.
In 1788, pending the great question of the regency, it was
contended on that side of the House of Commons from whence
extension of royal prerogative was least expected, that from the
moment parliament was made acquainted with the king’s incapacity,
a right attached to the prince of Wales to exercise the regal
functions, in the name of his father. On the 15th of December, the
duke of York rose in the House of Lords, and a profound silence
ensued. His royal highness said, that though perfectly unused as he
was to speak in a public assembly, yet he could not refrain from
offering his sentiments to their lordships on a subject in which the
dearest interests of the country were involved. He said, he entirely
agreed with the noble lords who had expressed their wishes to avoid
any question which tended to induce a discussion on the rights of
the prince. The fact was plain, that no such claim of right had been
made on the part of the prince; and he was confident that his royal
highness understood too well the sacred principles which seated the
house of Brunswick on the throne of Great Britain, ever to assume or
exercise any power, be his claim what it might, not derived from the
will of the people, expressed by their representatives and their
lordships in parliament assembled. On this ground his royal highness
said, that he must be permitted to hope that the wisdom and
moderation of all considerate men, at a moment when temper and
unanimity were so peculiarly necessary, on account of the dreadful
calamity which every description of persons must in common
lament, but which he more particularly felt, would make them wish
to avoid pressing a decision, which certainly was not necessary to
the great object expected from parliament, and which must be most
painful in the discussion to a family already sufficiently agitated and
afflicted. His royal highness concluded with saying, that these were
the sentiments of an honest heart, equally influenced by duty and
affection to his royal father, and attachment to the constitutional
rights of his subjects; and that he was confident, if his royal brother
were to address them in his place as a peer of the realm, that these
were the sentiments which he would distinctly avow.
His majesty in council having declared his consent, under the
great seal, to a contract of matrimony between his royal highness
the duke of York and her royal highness the princess Frederique
Charlotte Ulrique Catherine of Prussia, eldest daughter of the king of
Prussia, on the 29th of September, 1791, the marriage ceremony
was performed at Berlin. About six o’clock in the afternoon, all the
persons of the blood royal assembled in gala, in the apartments of
the dowager queen, where the diamond crown was put on the head
of princess Frederica. The generals, ministers, ambassadors, and the
high nobility, assembled in the white hall. At seven o’clock, the duke
of York, preceded by the gentlemen of the chamber, and the court
officers of state, led the princess his spouse, whose train was carried
by four ladies of the court, through all the parade apartments; after
them went the king, with the queen dowager, prince Lewis of
Prussia, with the reigning queen, and others of the royal family to
the white hall, where a canopy was erected of crimson velvet, and
also a crimson velvet sofa for the marriage ceremony. The royal
couple placed themselves under the canopy, before the sofa, the
royal family stood round them, and the upper counsellor of the
consistory, Mr. Sack, made a speech in German. This being over,
rings were exchanged; and the illustrious couple, kneeling on the
sofa, were married according to the rites of the reformed church.
The whole ended with a prayer. Twelve guns, placed in the garden,
fired three rounds, and the benediction was given. The new-married
couple then received the congratulations of the royal family, and
returned in the same manner to the apartments, where the royal
family, and all persons present, sat down to card-tables; after which,
the whole court, the high nobility, and the ambassadors, sat down to
supper, at six tables. The first was placed under a canopy of crimson
velvet, and the victuals served in gold dishes and plates. The other
five tables, at which sat the generals, ministers, ambassadors, all the
officers of the court, and the high nobility, were served in other
apartments.
During supper, music continued playing in the galleries of the first
hall, which immediately began when the company entered the hall.
At the dessert, the royal table was served with a beautiful set of
china, made in the Berlin manufactory. Supper being over, the whole
assembly repaired to the white hall, where the trumpet, timbrel, and
other music were playing; and the flambeau dance was begun, at
which the ministers of state carried the torches. With this ended the
festivity. The ceremony of the re-marriage of the duke and duchess
of York took place at the Queen’s Palace, London, on the 23d of
November.
The duchess of York died on the 6th of August, 1820.
The Dance of Torches.
As a note of illustration on this dance at the Prussian nuptials of
the duke and duchess of York, reference may be had to a slight
mention of the same observance on the marriage of the prince royal
of Prussia with the princess of Bavaria, in the Every-Day Book, vol. i.
p. 1551. Since that article, I find more descriptive particulars of it in
a letter from baron Bielfeld, giving an account of the marriage of the
prince of Prussia with the princess of Brunswick Wolfenbuttle, at
Berlin, in 1742. The baron was present at the ceremonial.
“As soon as their majesties rose from table, the whole company
returned into the white hall; from whence the altar was removed,
and the room was illuminated with fresh wax lights. The musicians
were placed on a stage of solid silver. Six lieutenant generals, and
six ministers of state, stood, each with a white wax torch in his
hand, ready to be lighted, in conformity to a ceremony used in the
German courts on these occasions, which is called ‘the dance of
torches,’ in allusion to the torch of Hymen. This dance was opened
by the new married prince and princess, who made the tour of the
hall, saluting the king and the company. Before them went the
ministers and the generals, two and two, with their lighted torches.
The princess then gave her hand to the king, and the prince to the
queen; the king gave his hand to the queen mother, and the
reigning queen to prince Henry; and in this manner all the princes
and princesses that were present, one after the other, and according
to their rank, led up the dance, making the tour of the hall, almost in
the step of the Polognese. The novelty of this performance, and the
sublime quality of the performers, made it in some degree
agreeable. Otherwise the extreme gravity of the dance itself, with
the continual round and formal pace of the dancers, the frequent
going out of the torches, and the clangour of the trumpets that rent
the ear, all these I say made it too much resemble the dance of the
Sarmates, those ancient inhabitants of the prodigious woods of this
country.”
On the 7th of June, 1794, about four o’clock in the morning, a
fire broke out at the duke of York’s palace at Oatlands. It began in
the kitchen, and was occasioned by a beam which projected into the
chimney, and communicated to the roof. His royal highness’s
armoury was in that wing of the building where the fire commenced,
in which forty pounds of gunpowder being deposited, a number of
most curious war-like instruments, which his royal highness had
collected on the continent, were destroyed. Many of the guns and
other weapons were presented from the king of Prussia, and
German officers of distinction, and to each piece was attached its
history. By the seasonable exertions of the neighbourhood, the
flames were prevented from spreading to the main part of the
building. The duchess was at Oatlands at the time, and beheld the
conflagration from her sleeping apartment, in the centre of the
mansion, from which the flames were prevented communicating by
destroying a gateway, over the wing that adjoined to the house. Her
royal highness gave her orders with perfect composure, directed
abundant refreshment to the people who were extinguishing the
flames, and then retired to the rooms of the servants at the stables,
which are considerably detached from the palace. His majesty rode
over from Windsor-castle to visit her royal highness, and staid with
her a considerable time.
On the 8th of April, 1808, whilst the duke of York was riding for
an airing along the King’s-road towards Fulham, a drover’s dog
crossed, and barked in front of the horse. The animal, suddenly
rearing, fell backwards, with the duke under him; and the horse
rising, with the duke’s foot in the stirrup, dragged him along, and did
him further injury. When extricated, the duke, with great
cheerfulness, denied he was much hurt, yet two of his ribs were
broken, the back of his head and face contused, and one of his legs
and arms much bruised. A gentleman in a hack chaise immediately
alighted, and the duke was conveyed in it to York-house, Piccadilly,
where his royal highness was put to bed, and in due time recovered
to the performance of his active duties.
On the 6th of August, 1815, the duke of York, on coming out of a
shower-bath, at Oatlands, fell, from the slippery state of the oilcloth,
and broke the large bone of his left arm, half way between the
shoulder and the elbow-joint. His royal highness’s excellent
constitution at that time assisted the surgeons, and in a fortnight he
again attended to business.
On the 11th of October, in the same year, his royal highness’s
library, at his office in the Horse-guards consisting of the best
military authors, and a very extensive collection of maps, were
removed to his new library (late her majesty’s) in the Green-park.
The assemblage is the most perfect collection of works on military
affairs in the kingdom.
It appears, from the report of the commissioners of woods,
forests, and land revenues, in 1816, that the duke of York purchased
of the commissioners the following estates: 1. The manor of Byfleet
and Weybridge, with Byfleet or Weybridge-park, and a capital
messuage and offices, and other messuages and buildings there. 2.
The manor of Walton Leigh, and divers messuages and lands
therein. 3. A capital messuage called Brooklands, with offices,
gardens, and several parcels of land, situated at Weybridge. 4. A
farm-house, and divers lands, called Brooklands-farm, at Weybridge.
5. A messuage and lands, called Childs, near Weybridge. 6. Two
rabbit-warrens within the manor of Byfleet and Weybridge. To this
property was to be added all lands and premises allotted to the
preceding by virtue of any act of enclosure. The sale was made to
his royal highness in May, 1809, at the price of £74,459. 3s.; but the
money was permitted to remain at the interest of 31⁄2 per cent. till
the 10th of June, 1815, when the principal and interest (amounting,
after the deduction of property-tax, and of the rents, which, during
the interval, had been paid to the crown, to £85,135. 5s. 9d.) were
paid into the Bank of England, to the account of the commissioners
for the new street. His royal highness also purchased about twenty
acres of land in Walton, at the price of £1294. 2s. 3d.
While the duke was in his last illness, members on both sides of
the House of Commons bore spontaneous testimony to his royal
highness’s impartial administration of his high office as commander-
in-chief; and united in one general expression, that no political
distinction ever interfered to prevent the promotion of a deserving
officer.
A statement in bishop Watson’s Memoirs, is a tribute to his royal
highness’s reputation.
“On the marriage of my son in August, 1805, I wrote,” says the
bishop, “to the duke of York, requesting his royal highness to give
him his protection. I felt a consciousness of having, through life,
cherished a warm attachment to the house of Brunswick, and to
those principles which had placed it on the throne, and of having on
all occasions acted an independent and honourable part towards the
government of the country, and I therefore thought myself justified
in concluding my letter in the following terms:—‘I know not in what
estimation your royal highness may hold my repeated endeavours, in
moments of danger, to support the religion and the constitution of
the country; but if I am fortunate enough to have any merit with you
on that score, I earnestly request your protection for my son. I am a
bad courtier, and know little of the manner of soliciting favours
through the intervention of others, but I feel that I shall never know
how to forget them, when done to myself; and, under that
consciousness, I beg leave to submit myself
‘Your Royal Highness’s
‘Most grateful servant,
‘R. Landaff.’
“I received a very obliging answer by the return of the post, and
in about two months my son was promoted, without purchase, from
a majority to a lieutenant-colonelcy in the Third Dragoon Guards.
After having experienced, for above twenty-four years, the neglect
of his majesty’s ministers, I received great satisfaction from this
attention of his son, and shall carry with me to my grave a most
grateful memory of his goodness. I could not at the time forbear
expressing my acknowledgment in the following letter, nor can I now
forbear inserting it in these anecdotes. The whole transaction will do
his royal highness no discredit with posterity, and I shall ever
consider it as an honourable testimony of his approbation of my
public conduct.
‘Calgarth Park, Nov. 9, 1805.’
——— ‘Do, my lord of Canterbury,
But one good turn, and he’s your friend for ever.’
‘Thus Shakspeare makes Henry VIII. speak of Cranmer; and from
the bottom of my heart, I humbly entreat your royal highness to
believe, that the sentiment is as applicable to the bishop of Landaff
as it was to Cranmer.
‘The bis dat qui cito dat has been most kindly thought of in this
promotion of my son; and I know not which is most dear to my
feelings, the matter of the obligation, or the noble manner of its
being conferred. I sincerely hope your royal highness will pardon this
my intrusion, in thus expressing my most grateful acknowledgments
for them both.
‘R. Landaff.’”
[31] Hist. of House of Austria. Rapin. Favine.
Mr. Charles Lamb.
To the Editor.
Dear Sir,
It is not unknown to you, that about sixteen years since I
published “Specimens of English Dramatic Poets, who lived about the
Time of Shakspeare.” For the scarcer Plays I had recourse to the
Collection bequeathed to the British Museum by Mr. Garrick. But my
time was but short, and my subsequent leisure has discovered in it a
treasure rich and exhaustless beyond what I then imagined. In it is
to be found almost every production in the shape of a Play that has
appeared in print, from the time of the old Mysteries and Moralities
to the days of Crown and D’Urfey. Imagine the luxury to one like me,
who, above every other form of Poetry, have ever preferred the
Dramatic, of sitting in the princely apartments, for such they are, of
poor condemned Montagu House, which I predict will not speedily
be followed by a handsomer, and culling at will the flower of some
thousand Dramas. It is like having the range of a Nobleman’s Library,
with the Librarian to your friend. Nothing can exceed the
courteousness and attentions of the Gentleman who has the chief
direction of the Reading Rooms here; and you have scarce to ask for
a volume, before it is laid before you. If the occasional Extracts,
which I have been tempted to bring away, may find an appropriate
place in your Table Book, some of them are weekly at your service.
By those who remember the “Specimens,” these must be considered
as mere after-gleanings, supplementary to that work, only
comprising a longer period. You must be content with sometimes a
scene, sometimes a song; a speech, or passage, or a poetical image,
as they happen to strike me. I read without order of time; I am a
poor hand at dates; and for any biography of the Dramatists, I must
refer to writers who are more skilful in such matters. My business is
with their poetry only.
Your well-wisher,
C. Lamb.
January, 27, 1827.
Garrick Plays.
No. I.
[From “King John and Matilda,” a Tragedy by Robert Davenport,
acted in 1651.]
John, not being able to bring Matilda, the chaste daughter of the
old Baron Fitzwater, to compliance with his wishes, causes her to be
poisoned in a nunnery.
Scene. John. The Barons: they being as yet ignorant of the murder,
and having just come to composition with the King after tedious
wars. Matilda’s hearse is brought in by Hubert.
John. Hubert, interpret this apparition.
Hubert. Behold, sir,
A sad-writ Tragedy, so feelingly
Languaged, and cast; with such a crafty cruelty
Contrived, and acted; that wild savages
Would weep to lay their ears to, and (admiring
To see themselves outdone) they would conceive
Their wildness mildness to this deed, and call
Men more than savage, themselves rational.
And thou, Fitzwater, reflect upon thy name,[32]
And turn the Son of Tears. Oh, forget
That Cupid ever spent a dart upon thee;
That Hymen ever coupled thee; or that ever
The hasty, happy, willing messenger
Told thee thou had’st a daughter. Oh look here!
Look here, King John, and with a trembling eye
Read your sad act, Matilda’s tragedy.
Barons. Matilda!
Fitzwater. By the lab’ring soul of a much-injured man,
It is my child Matilda!
Bruce. Sweet niece!
Leicester. Chaste soul!
John. Do I stir, Chester?
Good Oxford, do I move? stand I not still
To watch when the griev’d friends of wrong’d Matilda
Will with a thousand stabs turn me to dust,
That in a thousand prayers they might be happy?
Will no one do it? then give a mourner room,
A man of tears. Oh immaculate Matilda,
These shed but sailing heat-drops, misling showers
The faint dews of a doubtful April morning;
But from mine eyes ship-sinking cataracts,
Whole clouds of waters, wealthy exhalations,
Shall fall into the sea of my affliction,
Till it amaze the mourners.
Hubert. Unmatch’d Matilda;
Celestial soldier, that kept a fort of chastity
’Gainst all temptations.
Fitzwater. Not to be a Queen,
Would she break her chaste vow. Truth crowns your reed;
Unmatch’d Matilda was her name indeed.
John. O take into your spirit-piercing praise
My scene of sorrow. I have well-clad woes,
My scene of sorrow. I have well clad woes,
Pathetic epithets to illustrate passion,
And steal true tears so sweetly from all these,
Shall touch the soul, and at once pierce and please.
[Peruses the Motto and Emblems on the hearse.
“To Piety and Purity”—and “Lillies mix’d with Roses”—
How well you have apparell’d woe! this Pendant,
To Piety and Purity directed,
Insinuates a chaste soul in a clean body,
Virtue’s white Virgin, Chastity’s red Martyr!
Suffer me then with this well-suited wreath
To make our griefs ingenious. Let all be dumb,
Whilst the king speaks her Epicedium.
Chester. His very soul speaks sorrow.
Oxford. And it becomes him sweetly.
John. Hail Maid and Martyr! lo on thy breast,
Devotion’s altar, chaste Truth’s nest,
I offer (as my guilt imposes)
Thy merit’s laurel, Lillies and Roses;
Lillies, intimating plain
Thy immaculate life, stuck with no stain;
Roses red and sweet, to tell
How sweet red sacrifices smell.
Hang round then, as you walk about this hearse,
The songs of holy hearts, sweet virtuous verse.
Fitzwater. Bring Persian silks, to deck her monument;
John. Arabian spices, quick’ning by their scent;
Fitzwater. Numidian marble, to preserve her praise,
John. Corinthian ivory, her shape to praise:
Fitzwater. And write in gold upon it, In this breast
Virtue sate mistress, Passion but a guest.
John. Virtue is sweet; and, since griefs bitter be,
Strew her with roses, and give rue to me.
Bruce. My noble brother, I’ve lost a wife and son;[33]
You a sweet daughter. Look on the king’s penitence;
His promise for the public peace. Prefer
A public benefit.[34] When it shall please,
Let Heaven question him. Let us secure
And quit the land of Lewis.[35]
Fitzwater. Do any thing;
Do all things that are honorable; and the Great King
Make you a good king, sir! and when your soul
Shall at any time reflect upon your follies,
Good King John, weep, weep very heartily;
g , p, p y y;
It will become you sweetly. At your eyes
Your sin stole in; there pay your sacrifice.
John. Back unto Dunmow Abbey. There we’ll pay
To sweet Matilda’s memory, and her sufferings,
A monthly obsequy, which (sweet’ned by
The wealthy woes of a tear-troubled eye)
Shall by those sharp afflictions of my face
Court mercy, and make grief arrive at grace.
Song.
Matilda, now go take thy bed
In the dark dwellings of the dead;
And rise in the great waking day
Sweet as incence, fresh as May.
Rest there, chaste soul, fix’d in thy proper sphere,
Amongst Heaven’s fair ones; all are fair ones there.
Rest there, chaste soul, whilst we here troubled say:
Time gives us griefs, Death takes our joys away.
This scene has much passion and poetry in it, if I mistake not.
The last words of Fitzwater are an instance of noble temperament;
but to understand him, the character throughout of this mad, merry,
feeling, insensible-seeming lord, should be read. That the venomous
John could have even counterfeited repentance so well, is out of
nature; but supposing the possibility, nothing is truer than the way in
which it is managed. These old playwrights invested their bad
characters with notions of good, which could by no possibility have
coexisted with their actions. Without a soul of goodness in himself,
how could Shakspeare’s Richard the Third have lit upon those sweet
phrases and inducements by which he attempts to win over the
dowager queen to let him wed her daughter. It is not Nature’s
nature, but Imagination’s substituted nature, which does almost as
well in a fiction.
(To be continued.)
[32] Fitzwater: son of water. A striking instance of the compatibility of the
serious pun with the expression of the profoundest sorrows. Grief, as well
as joy, finds ease in thus playing with a word. Old John of Gaunt in
Shakspeare thus descants on his name: “Gaunt, and gaunt indeed;” to a
long string of conceits, which no one has ever yet felt as ridiculous. The
poet Wither thus, in a mournful review of the declining estate of his
family, says with deepest nature:—
The very name of Wither shows decay.
[33] Also cruelly slain by the poisoning John.
[34] i. e. of peace; which this monstrous act of John’s in this play comes
to counteract, in the same way as the discovered Death of Prince Arthur is
like to break the composition of the King with his Barons in Shakspeare’s
Play.
[35] The Dauphin of France, whom they had called in, as in Shakspeare’s
Play.
Literature.
Glances at New Books on my Table.
“Constable’s Miscellany of original and selected Publications” is
proposed to consist of various works on important and popular
subjects, with the view of supplying certain chasms in the existing
stock of useful knowledge; and each author or subject is to be kept
separate, so as to enable purchasers to acquire all the numbers, or
volumes, of each book, distinct from the others. The undertaking
commenced in the first week of the new year, 1827, with the first
number of Captain Basil Hall’s voyage to Loo-Choo, and the
complete volume of that work was published at the same time.
“Early Metrical Tales, including the History of Sir Egeir, Sir Gryme,
and Sir Gray-Steill.” Edinb. 1826. sm. 8vo. 9s. (175 copies printed.)
The most remarkable poem in this elegant volume is the rare
Scottish romance, named in the title-page, which, according to its
present editor, “would seem, along with the poems of sir David
Lindsay, and the histories of Robert the Bruce, and of sir William
Wallace, to have formed the standard productions of the vernacular
literature of the country.” In proof of this he adduces several
authorities; “and yet it is remarkable enough, that every ancient
copy should have hitherto eluded the most active and unremitting
research.” The earliest printed edition is presumed to have issued
from the press of Thomas Bassandyne, “the first printer of the
sacred Scriptures in Scotland.” An inventory of his goods, dated 18th
October, 1577, contains an item of three hundred “Gray Steillis,”
valued at the “pece VId. summa £VII. x. o.” Its editor would willingly
give the sum-total of these three hundred copies for “one of the said
Gray-Steillis, were he so fortunate as to meet with it.” He instances
subsequent editions, but the only copy he could discover was printed
at Aberdeen in 1711, by James Nicol, printer to the town and
university; and respecting this, which, though of so recent date, is at
present unique, “the editor’s best acknowledgments are due to his
friend, Mr. Douce, for the kind manner in which he favoured him
with the loan of the volume, for the purpose of republication.” On
the 17th of April, 1497, when James IV. was at Stirling: there is an
entry in the treasurer’s accounts, “Item, that samyn day to twa
Sachelaris that sang Gray Steil to the King, IXs.” In MS. collections
made at Aberdeen in 1627, called a “Booke for the Lute,” by Robert
Gordon, is the air of “Gray-Steel;” and a satirical poem in Scottish
rhyme on the marquis of Argyle, printed in 1686, is “appointed to be
sung according to the tune of old Gray Steel.” These evidences that
the poem was sung, manifest its popularity. There are conjectures as
to who the person denominated Sir Gray Steel really was, but the
point is undetermined.
In this volume there are thirteen poems. 1. Sir Gray-Steill above
spoken of. 2. The Tales of the Priests of Peblis, wherein the three
priests of Peebles, having met to regale on St. Bride’s day, agree,
each in turn, to relate a story. 3. Ane Godlie Dreame, by lady
Culross. 4. History of a Lord and his three Sons, much resembling
the story of Fortunatus. 5. The Ring of the Roy Robert, the printed
copies of which have been modernized and corrupted. 6. King
Estmere, an old romantic tale. 7. The Battle of Harlaw, considered by
its present editor “as the original of rather a numerous class of
Scotish historical ballads.” 8. Lichtoun’s Dreme, printed for the first
time from the Bannatyne MS. 1568. 9. The Murning Maiden, a poem
“written in the Augustan age of Scotish poetry.” 10. The Epistill of
the Hermeit of Alareit, a satire on the Grey Friers, by Alexander earl
of Glencairn. 11. Roswall and Lillian, a “pleasant history,” (chanted
even of late in Edinburgh,) from the earliest edition discovered,
printed in 1663, of which the only copy known is in the Advocates’
Library, from the Roxburghe sale. 12. Poem by Glassinberry, a name
for the first time introduced into the list of early Scotish poets, and
the poem itself printed from “Gray’s MS.” 13. Sir John Barleycorn,
from a stall-copy printed in 1781, with a few corrections, concerning
which piece it is remarked, that Burns’s version “cannot be said to
have greatly improved it.” There is a vignette to this ballad,
“designed and etched by the ingenious young artist, W. Geikie,” of
Edinburgh, from whence I take the liberty to cut a figure, not for the
purpose of conveying an idea of this “Allan-a-Maut,” who is
surrounded with like “good” company by Mr. Geikie’s meritorious
pencil, but to extend the knowledge of Mr. Geikie’s name, who is
perfectly unknown to me, except through the single print I refer to,
which compels me to express warm admiration of his correct feeling,
and assured talent.
Besides Mr. Geikie’s beautiful etching, there is a frontispiece by
W. H. Lizars from a design by Mr. C. Kirkpatrick Sharpe, and a
portrait of Alexander earl of Eglintoune 1670, also by Mr. Lizars, from
a curiously illuminated parchment in the possession of the present
earl.
SAYING NOT MEANING.
By William Basil Wake.
For the Table Book.
Two gentlemen their appetite had fed,
When, opening his toothpick-case, one said,
“It was not until lately that I knew
That anchovies on terrâ firmâ grew.”
“Grew!” cried the other, “yes, they grow, indeed,
Like other fish, but not upon the land;
You might as well say grapes grow on a reed,
Or in the Strand!”
“Why, sir,” return’d the irritated other,
“My brother,
When at Calcutta,
Beheld them bonâ fide growing;
He wouldn’t utter
A lie for love or money, sir; so in
This matter you are thoroughly mistaken.”
“Nonsense, sir! nonsense! I can give no credit
To the assertion—none e’er saw or read it;
Your brother, like his evidence, should be shaken.”
“Be shaken, sir! let me observe, you are
Perverse—in short—”
“Sir,” said the other, sucking his cigar,
And then his port—
“If you will say impossibles are true,
You may affirm just any thing you please—
That swans are quadrupeds, and lions blue,
And elephants inhabit Stilton cheese!
Only you must not force me to believe
What’s propagated merely to deceive.”
“Then you force me to say, sir, you’re a fool,”
Return’d the bragger.
Language like this no man can suffer cool;
It made the listener stagger;
So, thunder-stricken, he at once replied,
“The traveller lied
Who had the impudence to tell it you.”
“Zounds! then d’ye mean to swear before my face
That anchovies don’t grow like cloves and mace?”
“I do!”
Disputants often after hot debates
Leave the contention as they found it—bone,
And take to duelling, or thumping têtes;
Thinking, by strength of artery, to atone
For strength of argument; and he who winces
From force of words, with force of arms convinces!
With pistols, powder, bullets, surgeons, lint,
Seconds, and smelling-bottles, and foreboding,
Our friends advanced; and now portentous loading
(Their hearts already loaded) serv’d to show
It might be better they shook hands—but no;
When each opines himself, though frighten’d, right,
Each is, in courtesy, oblig’d to fight!
And they did fight: from six full measured paces
The unbeliever pull’d his trigger first;
And fearing, from the braggart’s ugly faces,
The whizzing lead had whizz’d its very worst,
Ran up, and with a duelistic tear,
(His ire evanishing like morning vapours,)
Found him possess’d of one remaining ear,
Who, in a manner sudden and uncouth,
Had given, not lent, the other ear to truth:
For, while the surgeon was applying lint,
He, wriggling, cried—“The deuce is in’t—
Sir! I meant—capers!”
Characters.
THE OLD GENTLEMAN.
Our old gentleman, in order to be exclusively himself, must be
either a widower or a bachelor. Suppose the former. We do not
mention his precise age, which would be invidious;—nor whether he
wears his own hair or a wig; which would be wanting in universality.
If a wig, it is a compromise between the more modern scratch and
the departed glory of the toupee. If his own hair, it is white, in spite
of his favourite grandson, who used to get on the chair behind him,
and pull the silver hairs out, ten years ago. If he is bald at top, the
hair-dresser, hovering and breathing about him like a second youth,
takes care to give the bald place as much powder as the covered; in
order that he may convey, to the sensorium within, a pleasing
indistinctness of idea respecting the exact limits of skin and hair. He
is very clean and neat; and in warm weather is proud of opening his
waistcoat half way down, and letting so much of his frill be seen; in
order to show his hardiness as well as taste. His watch and shirt-
buttons are of the best; and he does not care if he has two rings on
a finger. If his watch ever failed him at the club or coffee-house, he
would take a walk every day to the nearest clock of good character,
purely to keep it right. He has a cane at home, but seldom uses it,
on finding it out of fashion with his elderly juniors. He has a small
cocked hat for gala days, which he lifts higher from his head than
the round one, when made a bow to. In his pockets are two
handkerchiefs, (one for the neck at night-time,) his spectacles, and
his pocket-book. The pocket-book, among other things, contains a
receipt for a cough, and some verses cut out of an odd sheet of an
old magazine, on the lovely duchess of A., beginning—
When beauteous Mira walks the plain.
He intends this for a common-place book which he keeps, consisting
of passages in verse and prose cut out of newspapers and
magazines, and pasted in columns; some of them rather gay. His
principal other books are Shakspeare’s Plays and Milton’s Paradise
Lost; the Spectator, the History of England; the works of Lady M. W.
Montague, Pope, and Churchill; Middleton’s Geography, the
Gentleman’s Magazine; Sir John Sinclair on Longevity; several plays
with portraits in character; Account of Elizabeth Canning, Memoirs of
George Ann Bellamy, Poetical Amusements at Bath-Easton, Blair’s
Works, Elegant Extracts; Junius as originally published; a few
pamphlets on the American War and Lord George Gordon, &c. and
one on the French Revolution. In his sitting rooms are some
engravings from Hogarth and Sir Joshua; an engraved portrait of the
Marquis of Granby; ditto of M. le Comte de Grasse surrendering to
Admiral Rodney; a humorous piece after Penny; and a portrait of
himself, painted by Sir Joshua. His wife’s portrait is in his chamber,
looking upon his bed. She is a little girl, stepping forward with a
smile and a pointed toe, as if going to dance. He lost her when she
was sixty.
The Old Gentleman is an early riser, because he intends to live at
least twenty years longer. He continues to take tea for breakfast, in
spite of what is said against its nervous effects; having been
satisfied on that point some years ago by Dr. Johnson’s criticism on
Hanway, and a great liking for tea previously. His china cups and
saucers have been broken since his wife’s death, all but one, which
is religiously kept for his use. He passes his morning in walking or
riding, looking in at auctions, looking after his India bonds or some
such money securities, furthering some subscription set on foot by
his excellent friend sir John, or cheapening a new old print for his
portfolio. He also hears of the newspapers; not caring to see them
till after dinner at the coffee-house. He may also cheapen a fish or
so; the fishmonger soliciting his doubting eye as he passes, with a
profound bow of recognition. He eats a pear before dinner.
His dinner at the coffee-house is served up to him at the
accustomed hour, in the old accustomed way, and by the
accustomed waiter. If William did not bring it, the fish would be sure
to be stale, and the flesh new. He eats no tart; or if he ventures on
a little, takes cheese with it. You might as soon attempt to persuade
him out of his senses, as that cheese is not good for digestion. He
takes port; and if he has drank more than usual, and in a more
private place, may be induced by some respectful inquiries
respecting the old style of music, to sing a song composed by Mr.
Oswald or Mr. Lampe, such as—
Chloe, by that borrowed kiss,
or
Come, gentle god of soft repose;
or his wife’s favourite ballad, beginning—
At Upton on the Hill
There lived a happy pair.
Of course, no such exploit can take place in the coffee-room; but he
will canvass the theory of that matter there with you, or discuss the
weather, or the markets, or the theatres, or the merits of “my lord
North” or “my lord Rockingham;” for he rarely says simply, lord; it is
generally “my lord,” trippingly and genteelly off the tongue. If alone
after dinner, his great delight is the newspaper; which he prepares
to read by wiping his spectacles, carefully adjusting them on his
eyes, and drawing the candle close to him, so as to stand sideways
betwixt his ocular aim and the small type. He then holds the paper
at arm’s length, and dropping his eyelids half down and his mouth
half open, takes cognizance of the day’s information. If he leaves off,
it is only when the door is opened by a new comer, or when he
suspects somebody is over-anxious to get the paper out of his hand.
On these occasions, he gives an important hem! or so; and resumes.
In the evening, our Old Gentleman is fond of going to the
theatre, or of having a game of cards. If he enjoy the latter at his
own house or lodgings, he likes to play with some friends whom he
has known for many years; but an elderly stranger may be
introduced, if quiet and scientific; and the privilege is extended to
younger men of letters; who, if ill players, are good losers. Not that
he is a miser; but to win money at cards is like proving his victory by
getting the baggage; and to win of a younger man is a substitute for
his not being able to beat him at rackets. He breaks up early,
whether at home or abroad.
At the theatre, he likes a front row in the pit. He comes early, if
he can do so without getting into a squeeze, and sits patiently
waiting for the drawing up of the curtain, with his hands placidly
lying one over the other on the top of his stick. He generously
admires some of the best performers, but thinks them far inferior to
Garrick, Woodward, and Clive. During splendid scenes, he is anxious
that the little boy should see.
He has been induced to look in at Vauxhall again, but likes it still
less than he did years back, and cannot bear it in comparison with
Ranelagh. He thinks every thing looks poor, flaring, and jaded. “Ah!”
says he, with a sort of triumphant sigh, “Ranelagh was a noble
place! Such taste, such elegance, such beauty! There was the
duchess of A. the finest woman in England, sir; and Mrs. L., a mighty
fine creature; and lady Susan what’s her name, that had that
unfortunate affair with sir Charles. Sir, they came swimming by you
like the swans.”
The Old Gentleman is very particular in having his slippers ready
for him at the fire, when he comes home. He is also extremely
choice in his snuff, and delights to get a fresh box-full at Gliddon’s, in
King-street, in his way to the theatre. His box is a curiosity from
India. He calls favourite young ladies by their Christian names,
however slightly acquainted with them; and has a privilege also of
saluting all brides, mothers, and indeed every species of lady on the
least holiday occasion. If the husband for instance has met with a
piece of luck, he instantly moves forward, and gravely kisses the
wife on the cheek. The wife then says, “My niece, sir, from the
country;” and he kisses the niece. The niece, seeing her cousin
biting her lips at the joke, says, “My cousin Harriet, sir;” and he
kisses the cousin. He never recollects such weather, except during
the great frost, or when he rode down with Jack Skrimshire to
Newmarket. He grows young again in his little grand-children,
especially the one which he thinks most like himself; which is the
handsomest. Yet he likes best perhaps the one most resembling his
wife; and will sit with him on his lap, holding his hand in silence, for
a quarter of an hour together. He plays most tricks with the former,
and makes him sneeze. He asks little boys in general who was the
father of Zebedee’s children. If his grandsons are at school, he often
goes to see them; and makes them blush by telling the master or
the upper-scholars, that they are fine boys, and of a precocious
genius. He is much struck when an old acquaintance dies, but adds
that he lived too fast; and that poor Bob was a sad dog in his youth;
“a very sad dog, sir, mightily set upon a short life and a merry one.”
When he gets very old indeed, he will sit for whole evenings, and
say little or nothing; but informs you, that there is Mrs. Jones (the
housekeeper),—“She’ll talk.”—Indicator.
A HAPPY MEETING.
And doth not a meeting like this make amends
For all the long years I’ve been wand’ring away?
To see thus around me my youth’s early friends,
As smiling and kind as in that happy day!
Though haply o’er some of your brows, as o’er mine,
The snow-fall of time may be stealing—what then
Like Alps in the sunset, thus lighted by wine,
We’ll wear the gay tinge of youth’s roses again.
What soften’d remembrances come o’er the heart,
In gazing on those we’ve been lost to so long!
The sorrows, the joys, of which once they were part
Still round them, like visions of yesterday, throng,
As letters some hand hath invisibly traced,
When held to the flame will steal out on the sight,
So many a feeling, that long seem’d effaced,
The warmth of a meeting like this brings to light.
And thus, as in memory’s bark, we shall glide
To visit the scenes of our boyhood anew,
Tho’ oft we may see, looking down on the tide,
The wreck of full many a hope shining through—
Yet still, as in fancy we point to the flowers
That once made a garden of all the gay shore,
Deceiv’d for a moment, we’ll think them still ours,
And breath the fresh air of life’s morning once more
So brief our existence, a glimpse, at the most,
Is all we can have of the few we hold dear;
And oft even joy is unheeded and lost,
For want of some heart that could echo it near.
Ah! well may we hope, when this short life is gone,
To meet in some world of more permanent bliss,
For a smile, or a grasp of the hand, hast’ning on,
Is all we enjoy of each other in this.
But come—the more rare such delights to the heart,
The more we should welcome, and bless them the more—
They’re ours when we meet—they’re lost when we part,
Like birds that bring summer, and fly when ’tis o’er,
Thus circling the cup, hand in hand, ere we drink,
Let Sympathy pledge us, thro’ pleasure thro’ pain,
That fast as a feeling but touches one link,
H i h ll d it di t th h th h i
Her magic shall send it direct through the chain.
Lines to his Cousin
ON THE NEW YEAR,
By a Westminster Boy.
Time rolls away! another year
Has rolled off with him; hence ’tis clear
His lordship keeps his carriage
A single man, no doubt;—and thus
Enjoys himself without the fuss
And great expense of marriage.
His wheel still rolls (and like the river
Which Horace mentions) still for ever
Volvitur et volvetur.
In vain you run against him; place
your fleetest filly in the race,—
Here’s ten to one he’ll beat her.
Of all he sees, he takes a tithe,
With that tremendous sweeping scythe,
Which he keeps always going;
While every step he takes, alas!
Too plainly proves that flesh is grass,
When he sets out a mowing.
And though his hungry ravenous maw
Is crammed with food, both dress’d and raw,
I’ll wager any betting,
His appetite has ever been
Just like his scythe, sharp-set and keen,
Which never wanted whetting.
Could you but see the mighty treat
Prepared, when he sits down to eat
His breakfast or his dinner,—ah,
Not vegetable—flesh,—alone,
But timber, houses, iron, stone,
He eats the very china.
When maidens pray that he will spare
Their teeth, complexion, or their hair,
Alas! he’ll never hear ’em;
Grey locks and wrinkles hourly show,
What Ovid told us years ago,
Ut Tempus edax rerum!
In vain, my dearest girl, you choose
(Your face to wash) Olympic dews;
In vain you paint or rouge it;
He’ll play such havoc with your youth,
That ten years hence you’ll say with truth
Ah Edward!—Tempus fugit!
The glass he carries in his hand
Has ruin in each grain of sand;
But what I most deplore is,
He breaks the links of friendship’s chain,
And barters youthful love for gain:
Oh, Tempora! oh, Mores!
One sole exception you shall find,
(Unius generis of its kind,)
Wherever fate may steer us;
Tho’ wide his universal range,
Time has no power the heart to change
Of your Amicus Verus.
Bath Herald.
GERMAN UNIVERSITIES.
Germany, which embraces a population of thirty-six millions of
people, has twenty-two universities. The following table contains
their names according to the order of their foundation, and the
number of professors and students:
Universities.
When
founded.
Number
of
Pro-
fessors.
Number
of
Students.
Prague 1348 55 1449
Vienna 1365 77 1688
Heidelberg 1368 55 626
Warsbourg 1403 31 660
Leipsig 1409 81 1384
Rostock 1419 34 201
Fribourg 1450 35 556
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
ebookbell.com

More Related Content

PDF
Xml Schema Essentials R Allen Wyke Andrew Watt
PDF
Professional Adonet 2 Programming With Sql Server 2005 Oracle And Mysql Walla...
PPT
Web Services: Encapsulation, Reusability, and Simplicity
PDF
Zos Job Control Language 5th Ed 5th Edition Gary Deward Brown
PPTX
QVD Metadata Profile App in Qlik Sense
PDF
Introduction To Teradata Warehouse Teradata Database Release V2r51 Teradata W...
PDF
Domain Architecture Models And Architecture For Umi Applications Daniel J Duffy
PDF
Professional Microsoft Sql Server Analysis Services 2008 With Mdx Sivakumar H...
Xml Schema Essentials R Allen Wyke Andrew Watt
Professional Adonet 2 Programming With Sql Server 2005 Oracle And Mysql Walla...
Web Services: Encapsulation, Reusability, and Simplicity
Zos Job Control Language 5th Ed 5th Edition Gary Deward Brown
QVD Metadata Profile App in Qlik Sense
Introduction To Teradata Warehouse Teradata Database Release V2r51 Teradata W...
Domain Architecture Models And Architecture For Umi Applications Daniel J Duffy
Professional Microsoft Sql Server Analysis Services 2008 With Mdx Sivakumar H...

Similar to Xml Schema Essentials First Edition R Allen Wyke Andrew Watt (20)

PDF
Programming Entity Framework Building Data Centric Apps with the ADO NET Enti...
PDF
Euclid Data Model 101 - Episode 01: Overview
PDF
Concurrent Programming On Windows Joe Duffy
PDF
Designing Security Architecture Solutions 1st Jay Ramachandran
PDF
Coldfusion Mx Developers Cookbook Developers Library 1st Edition Peter Freitag
PDF
cloudcomputingcvbnxcvbncvbncfvbnsdfghnmcpdf
PPT
UnderstandingLDAP.ppt
PPTX
Practical OData
PPTX
NISO/NFAIS Joint Virtual Conference: Connecting the Library to the Wider Worl...
PDF
Database System Concepts 6th Edition, (Ebook PDF)
PDF
Database System Concepts 6th Edition, (Ebook PDF)
PDF
Database System Concepts 6th Edition, (Ebook PDF)
PPT
Web Services Discovery for Devices
PDF
Download Complete Building the Data Warehouse 3rd Edition W. H. Inmon PDF fo...
PDF
Denodo 6.0: Self Service Search, Discovery & Governance using an Universal Se...
PDF
Professional Sql Server 2005 Clr Programming With Stored Procedures Functions...
PPT
Arc Ready Cloud Computing
DOCX
Essay Outline There are several vital elements to any successful.docx
PDF
Building the Data Warehouse 3rd Edition W. H. Inmon
PDF
Application Kit Framework Reference Appkitobjc Apple Computer
Programming Entity Framework Building Data Centric Apps with the ADO NET Enti...
Euclid Data Model 101 - Episode 01: Overview
Concurrent Programming On Windows Joe Duffy
Designing Security Architecture Solutions 1st Jay Ramachandran
Coldfusion Mx Developers Cookbook Developers Library 1st Edition Peter Freitag
cloudcomputingcvbnxcvbncvbncfvbnsdfghnmcpdf
UnderstandingLDAP.ppt
Practical OData
NISO/NFAIS Joint Virtual Conference: Connecting the Library to the Wider Worl...
Database System Concepts 6th Edition, (Ebook PDF)
Database System Concepts 6th Edition, (Ebook PDF)
Database System Concepts 6th Edition, (Ebook PDF)
Web Services Discovery for Devices
Download Complete Building the Data Warehouse 3rd Edition W. H. Inmon PDF fo...
Denodo 6.0: Self Service Search, Discovery & Governance using an Universal Se...
Professional Sql Server 2005 Clr Programming With Stored Procedures Functions...
Arc Ready Cloud Computing
Essay Outline There are several vital elements to any successful.docx
Building the Data Warehouse 3rd Edition W. H. Inmon
Application Kit Framework Reference Appkitobjc Apple Computer
Ad

Recently uploaded (20)

PPTX
Cell Types and Its function , kingdom of life
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Computing-Curriculum for Schools in Ghana
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Cell Structure & Organelles in detailed.
PDF
Yogi Goddess Pres Conference Studio Updates
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Trump Administration's workforce development strategy
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Lesson notes of climatology university.
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Pharma ospi slides which help in ospi learning
Cell Types and Its function , kingdom of life
O5-L3 Freight Transport Ops (International) V1.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Computing-Curriculum for Schools in Ghana
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Cell Structure & Organelles in detailed.
Yogi Goddess Pres Conference Studio Updates
Final Presentation General Medicine 03-08-2024.pptx
Anesthesia in Laparoscopic Surgery in India
Microbial disease of the cardiovascular and lymphatic systems
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Trump Administration's workforce development strategy
Chinmaya Tiranga quiz Grand Finale.pdf
Orientation - ARALprogram of Deped to the Parents.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Lesson notes of climatology university.
Supply Chain Operations Speaking Notes -ICLT Program
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Pharma ospi slides which help in ospi learning
Ad

Xml Schema Essentials First Edition R Allen Wyke Andrew Watt

  • 1. Xml Schema Essentials First Edition R Allen Wyke Andrew Watt download https://ebookbell.com/product/xml-schema-essentials-first- edition-r-allen-wyke-andrew-watt-55675806 Explore and download more ebooks at ebookbell.com
  • 2. Here are some recommended products that we believe you will be interested in. You can click the link to download. Xml Schema Essentials R Allen Wyke Andrew Watt https://ebookbell.com/product/xml-schema-essentials-r-allen-wyke- andrew-watt-4123010 Xml Schema 1st Eric Van Der Vlist https://ebookbell.com/product/xml-schema-1st-eric-van-der- vlist-2158922 Definitive Xml Schema Walmsley Priscilla https://ebookbell.com/product/definitive-xml-schema-walmsley- priscilla-22041322 Definitive Xml Schema 2nd Edition Walmsley Priscilla https://ebookbell.com/product/definitive-xml-schema-2nd-edition- walmsley-priscilla-11789498
  • 3. The Xml Schema Complete Reference 1st Cliff Binstock https://ebookbell.com/product/the-xml-schema-complete-reference-1st- cliff-binstock-2158748 Modeling Business Objects With Xml Schema 1st Edition Berthold Daum https://ebookbell.com/product/modeling-business-objects-with-xml- schema-1st-edition-berthold-daum-4646270 The Art Of Xsd Sql Server Xml Schema Collections Sebastian J https://ebookbell.com/product/the-art-of-xsd-sql-server-xml-schema- collections-sebastian-j-51224516 The Art Of Xsd Sql Server Xml Schemas Jacob Sebastian https://ebookbell.com/product/the-art-of-xsd-sql-server-xml-schemas- jacob-sebastian-1730398 Xml For Bioinformatics 1st Edition Ethan Cerami https://ebookbell.com/product/xml-for-bioinformatics-1st-edition- ethan-cerami-2031382
  • 6. XML Schema Essentials John Wiley & Sons, Inc. Wiley Computer Publishing R. Allen Wyke Andrew Watt
  • 8. XML Schema Essentials John Wiley & Sons, Inc. Wiley Computer Publishing R. Allen Wyke Andrew Watt
  • 9. Publisher: Robert Ipsen Editor: Cary Sullivan Developmental Editor: Scott Amerman Associate Managing Editor: Penny Linskey Associate New Media Editor: Brian Snapp Text Design & Composition: D&G Limited, LLC Designations used by companies to distinguish their products are often claimed as trademarks. In all instances where John Wiley & Sons, Inc., is aware of a claim, the product names appear in initial capital or ALL CAPITAL LETTERS. Readers, however, should contact the appropriate companies for more complete information regarding trademarks and registration. This book is printed on acid-free paper. Copyright © 2002 by R. Allen Wyke and Andrew Watt. All rights reserved. Published by John Wiley & Sons, Inc. 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 Copy- right 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) 750-4744. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 605 Third Avenue, New York, NY 10158-0012, (212) 850-6011, fax (212) 850- 6008, E-Mail: PERMREQ @ WILEY.COM. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold with the understanding that the publisher is not engaged in professional services. If professional advice or other expert assistance is required, the services of a competent professional person should be sought. Library of Congress Cataloging-in-Publication Data: ISBN: 0-471-412597 Printed in the United States of America. 10 9 8 7 6 5 4 3 2 1
  • 10. Introduction ix Acknowledgments xi About the Authors xiii Part One Getting Started 1 Chapter 1 Elementary XML Schema 3 What Is XML Schema? 5 How Does an XML Schema Processor Work? 6 What Is XML Schema for? 7 XSD Schema Schema Components 7 Other Schema Languages for XML 8 The DTD Descended from SGML 8 XSD Schema Tools 9 XML Schema Document 14 C HAPTE R Contents iii
  • 11. Root of an XML Schema Document 16 Declaring the Location of Your XML Schema Document 16 Declaring Elements and Defining Types 17 Defining Simple Types 17 Defining Complex Types 25 Anonymous Complex Types 25 Named Complex Types 26 Using Anonymous or Named Complex Types 29 Declarations 34 Annotations in Schema 42 Standard XML Comments 42 The <annotation> Element 43 Empty Element Declaration 45 The anyType Type 50 Occurrence Constraints 51 Cardinality in DTDs 51 minOccurs and maxOccurs 51 Defining Your Own Simple Type 56 Model Groups in Schema 57 Sequence Group 57 Choice Group 57 All Group 58 Attribute Groups 61 More about the XML 1.0 DTD Content Model 62 Validation in XSD Schema 63 Validation versus Assessment 64 XML Information Set 67 Post-Schema Validation Infoset 69 Summary 69 Chapter 2 XSD Elements 71 XML Elements 72 Defining within a DTD 72 Limitations 76 iv Contents
  • 12. Moving On to XSD Elements 77 <xsd:element>: A Closer Examination 81 Default Values 83 Substitution Groups 85 Null Values 92 Attributes 93 Complex Content 99 Importing Elements from Other Locations 107 Redefining Elements 111 More on <xsd:complexType> 112 Using a Sequence 114 Grouping 114 Summary 119 Chapter 3 Adding Attributes 121 What Are Attributes? 122 Additional Metadata 122 Application Uses 125 Storing Data 126 Hybrid Approaches 128 Considerations for Using Attributes 130 XML Attributes Foundation 130 Syntax 130 Capabilities 131 XSD Attributes: The Next Generation 132 Syntax Changes 132 Further Capabilities 134 Using Attributes 136 Scope 136 Qualification 138 Defaults 140 Grouping 141 Inclusion of Other Attributes 142 Summary 142 Contents v
  • 13. Part Two Going Beyond DTDs 145 Chapter 4 Applying Datatypes 147 What Are Datatypes? 147 Primitive Datatypes 149 Derived Datatypes 152 Defining Our Own Datatypes 152 More on Simple Types 157 Defining Lists 160 Creating a Union 162 Constraining Type Definitions 167 Controlling Digits 171 Handling White Space 174 Pattern Matching 180 Applicability of Facets 181 Summary 183 Chapter 5 Data Facets 185 Fundamental and Constraining Facets 186 Constraining Facets in XSD Schema 186 The length Element 187 The minLength Element 195 The maxLength Element 198 The pattern Element 200 Parts Catalog Example 202 Postal Code Examples 206 The enumeration Element 211 Simple Enumeration Example 212 U.S. States Example 213 The whiteSpace Element 216 Summary 217 Chapter 6 More about Data Facets 219 The maxExclusive Element 220 The maxInclusive Element 223 The minExclusive Element 225 vi Contents
  • 14. The minInclusive Element 228 The totalDigits and fractionDigits Facets 233 Summary 238 Chapter 7 Grouping Elements and Attributes 239 Reusing Definitions with Groups 240 Nesting Sequence Groups 245 Nesting Choice Groups 246 Substitution Groups 250 Attribute Groups 257 Summary 258 Chapter 8 Deriving Types 259 Deriving Types by Extension 260 Deriving Types by Restriction 271 The enumeration Element 279 The pattern Element 282 The xsi:type Attribute 284 Summary 285 Part Three Next Steps 287 Chapter 9 Uniqueness and Keys in XSD Schema 289 Identity-Constraint Definitions 289 The <xsd:unique> Element 290 The <xsd:key> and <xsd:keyref> Elements 298 Summary 303 Chapter 10 Bringing the Parts Together 305 Modularizing Schemas 305 How to Use Schema Modules 306 Creating the Example 325 Planning the Example 325 Defining the Information Needs 325 Documenting the Schema 326 Basic Schema Templates 327 Modularizing the Schemas 328 Contents vii
  • 15. Creating the Staff Schema 329 Starting the Schema 332 Creating the Customer Schema 342 Creating the Type Library 342 Part Four Appendixes 347 Appendix A Datatypes 349 Appendix B Data Facets 371 Index 379 viii Contents T E A M F L Y
  • 16. Back in February 1998, XML 1.0 was released among the most hype and media coverage that the Internet community had seen since the first version of Java. XML was supposed to solve many of the problems that existed in heteroge- neous environments, where applications were forced to communicate and exchange data in proprietary formats. The explosion of the Web had intro- duced the common HTML format for marking up and exchanging documents, but the structure and potential of HTML to be more than that simply did not exist. XML, whose foundation was based on SGML, provided a means for people, companies, or entire industries to define languages that could be used to mark up data in a method that others could support and understand. Simply conforming to the well-formed and valid (which is technically optional) requirements of XML was a huge step, and if you coupled that with inherit structure of document type definitions (DTD), users were able to provide a wealth of knowledge to partners with whom they exchanged data. XML offered some datatyping, however, and did not really support a more flexible means of defining schemas. To help accommodate these deficiencies, other standards such as Datatypes for DTDs (DT4DTD), Schema for Object-Oriented XML (SOX), XML Data, and Introduction ix
  • 17. Document Definition Markup Language (DDML) were developed and combined with XML data for exchanges. But while these provided many of the features that users needed, integrating multiple standards were cumbersome and less desired than a single, standard approach. Enter XML Schema (XSD). XSD, which was inspired by all the previously mentioned standards, does not necessarily replace XML—but in many senses of the word, it can be thought of as XML on steroids. It can be the perfect solution for large solutions that include many various types of data integration. When you have applica- tions or entire systems that need to communicate yet have very diverse meth- ods of storing data, XSD can act as the bridge between these systems. These complex solutions need more, and XSD offers that. What to Expect In XML Schema Essentials, our job as authors is to expose you to the various publications that are part of the XSD Recommendations. For those of you who have attempted to read and study the recommendations, you know that it can be complex and hard to follow. But just knowing and understanding the stan- dard is only half the battle. We will also expose you to using it to solve real- world problems as well as have discussions about best practices and how you can get the most out of your implementation. Our goal is simple: for you to finish this book and not only understand XSD but also understand what you can do with it. Book Organization In our attempt to teach you XSD, we have taken the approach of stepping through the recommendations from a functional standpoint rather than from top to bottom. The book itself is divided into four parts. The first part, “Get- ting Started,” introduces you to XSD. You will learn the basic concepts, how to define elements, and how to add attributes to those elements. Part Two, “Going beyond DTDs,” will focus on functionality that is open and beyond that found in XML DTDs. You will learn about datatypes and how to derive your own datatypes. There are also a couple of chapters that focus on data facets, which are ways you can constrain things such as datatypes. There is also a chapter on grouping elements and attributes. One of the things you will quickly learn about XSD is that you can define more than one root ele- ment. The third part of the book, “Next Steps,” is just that: next steps. In the final two chapters of the book, which are contained in this section, you will learn about some advanced topics that revolve around the use of XSD schemas and x Introduction
  • 18. essentially expose yourself to a deeper level of topics than covered in previous chapters. You will also work through an example that ties together everything you have learned up until this point to result in a full understanding of XSD. Finally, in Part Four, which contains Appendixes A and B, we have included a reference for both the datatypes (primitive and derived) and the facets avail- able in the XSD Recommendations. We hope that you will use the material contained here even after you have finished reading the book, because it can serve as a valuable reference. A Final Thought This brief introduction should basically prepare you for what to expect from the pages that follow. We did not want to waste your time here rambling on about random thoughts of how XSD will solve the world’s problems. Simply put, we want you to come to your own conclusions. So, we have saved our discussion of why and how XSD could possibly do so, at least in the comput- ing world, for the chapters and pages within the book itself. R. Allen Wyke Andrew Watt Acknowledgments R. Allen Wyke On the publishing side, I would like to thank Bob Kern of TIPS Publishing and my co-author, Andrew, for their professionalism, hard work, and overall sup- port in the proposing and writing of this book. I would also like to thank all the people at Wiley who worked on the book and helped make sure it was the best it could be. Andrew Watt I would like to thank my co-author, Allen, for his contribution to the develop- ment and writing of this book. Thanks, too, to Scott Amerman, Penny Linskey, and the team at Wiley for doing all that was necessary to bring this book to fruition. Introduction xi
  • 19. I would like to dedicate this book to the citizens of New York City, the United States of America, and the world for their perseverance and strength following the tragic events that occurred September 11, 2001. R. Allen Wyke I would like to dedicate this book to the memory of my late father, George Alec Watt, a very special human being. Andrew Watt
  • 20. R. Allen Wyke R. Allen Wyke of Durham, North Carolina is the Vice-President of Technology at Blue292, a pioneering company on the forefront of environment, health, safety, and emergency management software and services. At Blue292, he works with management and engineering to help ensure and create products that have the proper vision and direction while fulfilling customers’ expecta- tions. He is constantly working with Java, XML, JavaScript, and other related Internet technologies—all of which are part of the framework used for the Blue292 systems. Allen, who wrote his first computer program at the age of eight, has also developed intranet Web pages for a leading telecommunications and net- working company in addition to working on several Internet sites. He has programmed in everything from C++, Java, Perl, Visual Basic, and JavaScript to Lingo as well as having experience with both HTML/XHTML and DHTML. He has also published roughly a dozen books on various Internet technologies that include topics such as Perl, JavaScript, PHP, and XML. In the past, he has also written the monthly “Webmaster” column for SunWorld and a weekly article, “Integrating Windows and Unix,” for ITworld.com. About the Authors xiii
  • 21. xiv About the Authors Andrew Watt Andrew Watt is an independent consultant and author based in the United Kingdom with an interest and expertise in the growing family of XML tech- nologies. He wrote his first programs in 6502 Assembly Language and BBC Basic around 1985 and has programmed in Pascal, Prolog, Lotus Domino, and a variety of Web and other technologies including HTML/XHTML and JavaScript. He works with XML, XSLT, SVG, and various other XML technolo- gies on a regular basis and is excited by the progressive transition of the XML technologies from potential to reality as the pieces of the XML jigsaw puzzle appear one by one from the World Wide Web Consortium (W3C). Andrew is the author of Designing SVG Web Graphics (published by New Riders) and XPath Essentials (published by Wiley) as well as being co-author or contributing author to XHTML, XML & Java 2 Platinum Edition (published by Que), Professional XSL, Professional XML 2nd Edition and Professional XML Meta Data (published by Wrox), and Sams Teach Yourself JavaScript in 21 Days (in press at Sams).
  • 24. 3 C HAPTE R 1 Elementary XML Schema The World Wide Web Consortium’s XML Schema is arguably one of the most important and far-reaching recommendations related to XML to come from the W3C. Since its introduction as a W3C recommendation in 1998, Extensible Markup Language (XML) has had a rapidly growing impact on the World Wide Web and as a basis for electronic business. As the impact of XML has grown, the need to integrate XML with existing technologies, such as programming lan- guages and relational database management systems, and the need to exchange information expressed in XML has led to demands for a schema lan- guage written in XML that will constrain the allowed structure of a class of XML documents with precision and that can also constrain the datatypes that are permitted at individual locations within such a structure. The need for a new schema language arose, in part, from the limitations of the Document Type Definition (DTD), which was the form of XML schema defined within the XML 1.0 Recommendation of February 1998. As well as being one of the most important recommendations, the W3C XML Schema Recommendation is one of the most complex, and at times abstract, XML technology specifications. In this book, we will be emphasizing aspects of W3C XML Schema that are practical, using many examples of W3C
  • 25. 4 Chapter 1 <?xml version="1.0"?> <Book> <Title>XML Schema Essentials</Title> <Authors> <Author>R. Allen Wyke</Author> <Author>Andrew Watt</Author> </Authors> <Publisher>John Wiley</Publisher> </Book> Listing 1.1 Simple XML instance document (Book.xml). XML schemas and introducing the theory that sheds light on the practical use of schemas. Let’s take a quick look at a simple XML schema so that you can see what one looks like. An XML document that is described by an XML schema is called an instance document. Listing 1.1 shows a very simple XML instance document. A schema expressed in W3C XML Schema syntax that describes the permit- ted content of Listing 1.1 is shown in Listing 1.2. The details of the syntax are not essential for you to understand at this stage. As you can see, the schema of XMLSchema is substantially longer than the doc- ument it describes or defines. For the moment, do not worry about the detail of the schema. The <xsd:annotation> and <xsd:documentation> elements enable us to document the purpose of a schema for a human reader. The <xsd:element> and <xsd:attribute> elements enable us to declare elements and attributes that are per- mitted in instance documents. The <xsd:complexType> element enables us to define the permitted complex type content of certain elements. How to use XSD Schema elements such as <xsd:element>, <xsd:complexType>, <xsd:attribute>, and so on will be introduced a little later in this chapter. The World Wide Web Consortium, or W3C, has termed its version of a schema language as simply XML Schema. In reality, a number of other XML schema languages existed for some time before W3C completed the development of XML Schema. So, to avoid ambiguity, when we refer to the specification for the W3C flavor of XML Schema, we will use the terms W3C XML Schema or XSD Schema to refer to W3C’s type of XML Schema, because an earlier name for the W3C XML Schema was XML Schema Definition Language, abbreviated to XSD. When we refer to a specific example of a schema written in the XSD Schema language (with the upper-case initial letter of Schema), we will use the term XSD schema (with the lower-case initial letter of schema). Throughout this book, we will be using the indicative namespace prefix xsd to refer to elements such as <xsd:complexType> (which are part of XSD Schema). NOTE T E A M F L Y
  • 26. Elementary XML Schema 5 <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:annotation> <xsd:documentation> This is a sample XML Schema for Chapter 1 of XML Schema Essentials. </xsd:documentation> </xsd:annotation> <xsd:element name="Book"> <xsd:complexType> <xsd:sequence> <xsd:element name="Title" ref="Title"/> <xsd:element name="Authors" ref="Authors"/> <xsd:element name="Publisher" ref="Publisher"/> </xsd:sequence> <xsd:attribute name="pubCountry" type="xsd:string"/> </xsd:complexType> </xsd:element> <xsd:element name="Title" type="xsd:string"/> <xsd:element name="Authors"> <xsd:complexType> <xsd:sequence> <xsd:element name="Author" ref="Author" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Author" type="xsd:string"/> <xsd:element name="Publisher" type="xsd:string"/> </xsd:schema> Listing 1.2 W3C XML Schema syntax describing content of Listing 1.1 (Book.xsd). What Is XML Schema? XML Schema is the W3C-recommended schema definition language, expressed in XML 1.0 syntax, which is intended to describe the structure and constrain the content of documents written in XML. It is explicitly intended to improve on the schema functionality that was provided by the DTD, which was the original form of schema for XML documents that the W3C recommended in 1998 when XML was first released.
  • 27. 6 Chapter 1 The W3C XML Schema became a full W3C recommendation in May 2001. Unusually, the final recommendation was released in three parts. The first part, Part 0, is a primer that is intended to introduce XML Schema in a non- formal way (from W3C’s point of view) and is located at www.w3.org/ TR/2001/REC-xmlschema-0-20010502/. Part 1 is a normative W3C docu- ment, defines structures that XML Schema supports, and is located at www.w3.org/TR/2001/REC-xmlschema-1-20010502/. Part 2 is also a norma- tive W3C document, defines the datatypes that W3C XML Schema supports, describes mechanisms for creating new datatypes, and is located at www.w3.org/TR/2001/REC-xmlschema-2-20010502/. An XSD Schema schema is intended to define the structure and constrain the content of a class of XML documents. Given the terminology “class,” such documents are often termed instance documents. Instance “documents” need not exist as document files but can exist as a stream of bytes or as a collection of XML Information Set items. How Does an XML Schema Processor Work? In much of this book, we will refer to the relationship between an XSD schema and instance documents as if an XSD schema-aware validating processor actu- ally directly processed the instance document. In fact, an XSD schema-aware processor operates on a set (called the information set) of information items rather than on the instance document itself. This method is similar to the way that an XSLT/XPath processor operates, in reality, on a source tree of nodes rather than directly on the elements in a source XML document. Later in this chapter, we will take a look at the XML Information Set specification and examine how the XML Information Set is relevant to XSD Schema. It isn’t surprising that an XSD Schema processor does not operate directly on an XML instance document; after all, an instance document is simply a series of characters. An XML parser extracts a series of logical tokens by pars- ing the characters in the serialized document. In the case of a parser that is XML Information Set-aware, the logical tokens are termed information items. There is, for example, a document information item (broadly corresponding to the document entity) that has several properties. Among the properties of the document information item is the [children] property. Note that the name of a property of an information item, such as the [children] property, is written enclosed in square brackets. One of the information items in the [children] property of the document information item is the element information item, which represents the document element of the instance document. NOTE
  • 28. Elementary XML Schema 7 What Is XML Schema for? The purpose of XML Schema is to define the structure of XML instance docu- ments. By defining and constraining the content of XML instance documents, it becomes possible to exchange information between applications with greater confidence and with less custom programming to test and confirm the structure of an instance document, or to confirm that the data in a particular part of the document is of a particular datatype. XSD Schema adds the capability to combine schemas from more than one source. For example, we could generate an invoice perhaps by combining a schema from a customer’s purchase order (which includes information such as shipping address, billing address, and so on) and billing information from our own accounts department (describing information such as price, discount allowed, and so on). This technique would enable schemas to be reused in a variety of combinations, thus improving efficiency. XSD Schema Schema Components The W3C XML Schema Recommendation indicates that an XSD schema com- prises 13 types of schema components that fall broadly into three groups: pri- mary, secondary, and helper components. The XSD Schema Recommendation refers to the following primary components: ■ ■ Simple type definitions ■ ■ Complex type definitions ■ ■ Attribute declarations ■ ■ Element declarations Primary components that are type definitions can have names. Attribute declarations and element declarations must have names. The following are the secondary components: ■ ■ Attribute group definitions ■ ■ Identity-constraint definitions ■ ■ Model group definitions ■ ■ Notation declarations The final five XSD Schema components are referred to as helper components and provide parts of other components: ■ ■ Annotations ■ ■ Model groups
  • 29. 8 Chapter 1 ■ ■ Particles ■ ■ Wildcards ■ ■ Attribute uses This chapter introduces the syntax to enable you to use many of the compo- nents just mentioned. Later chapters will detail how they are to be used. Other Schema Languages for XML Other schema languages are written in XML and are designed for use in defin- ing and describing XML instance documents. This book does not describe them in detail because that is not its intended purpose. You should be aware of the existence of these other schema languages, however, and where you can obtain information about them. XML-Data Reduced, often known simply as XDR, is a schema language that antedated the XSD Schema language. XDR is routinely used within the BizTalk Framework (www.biztalk.org) sponsored by Microsoft and is sup- ported by Microsoft’s MSXML parser. Another important alternative schema language for XML is now termed RELAX NG. RELAX NG, standing for RELAX New Generation, is an amal- gam of two embryonic schema languages, RELAX and TREX. RELAX NG is being developed by the Organization for Advancement of Structured Information Standards (OASIS), found at www.oasis-open.org. These XML schemas are written for XML as well as being written in XML. The original schema for XML 1.0 was the DTD that was, however, not written in XML. The DTD Descended from SGML The first form of schema for XML documents was the Document Type Defini- tion. Definitive information about the XML Document Type Definition is con- tained in the XML 1.0 Recommendation. At the time that XML became a recommendation, few people envisaged how it would evolve from being a document description language into one that would be used for many data- centric, rather than document-centric, applications. Not surprisingly, then, the DTD created largely with document-centric use in mind was found to have inadequacies when routinely applied in a data-centric context. Among the limitations of the DTD are the following: ■ ■ Datatyping is very weak. ■ ■ DTDs have a limited range of content models.
  • 30. Elementary XML Schema 9 ■ ■ The content cannot be validated precisely where it is of mixed content type. ■ ■ Cardinality is limited to being defined to zero, one, or many occurrences. ■ ■ DTDs lack named element or attribute groups that would enable us to reuse them. ■ ■ XSD Schema was designed, among other things, to provide superior datatyping to the DTD, to provide greater flexibility but yet with control of content models, and to provide definitions of cardinality not possible using a DTD. Later in the chapter, we will look in a little more detail at comparisons between DTDs and XSD schemas once you have been introduced to some commonly used XSD Schema constructs. XSD Schema Tools You might well already have your own favorite tools with which to create XML documents and XSD schemas. If so, then feel free to use these as you work through the examples in this book. The tools mentioned here include tools that the authors use on an ongoing basis. We are making no specific claims for their superiority for a particular purpose, but they do enable us to work with XSD Schema to explore its capabilities and complexities. Each of the XSD Schema tools is an early implementation; therefore, you can expect to find some situations where inappropriate error messages are issued or where an error in a schema is overlooked. Schema Checkers At this writing, an online XSD Schema checking service is available using XML Schema Validator provided at the W3C Web site. The schema validation service for the May 2001 Recommendation is located at www.w3.org/ 2001/03/webdata/xsv. Figure 1.1 shows part of the form that you must use in order to get a schema validated. Essentially, your schema needs to be accessi- ble via a URL in order to be validated. The online checking service can check an XSD schema for validity (that is, conformity to the W3C Recommendation), or it can validate an instance docu- ment against a schema. The online schema checking service can be used to process files that are accessible at a URL, or you can upload files for checking. NOTE
  • 31. 10 Chapter 1 Figure 1.1 Online XSD schema validation service from the W3C. Figure 1.2 shows the form filled in just prior to asking the processor to vali- date an instance document (Book.xml, Listing 1.1) against its XSD schema (Book.xsd, Listing 1.2). Be careful to include the http:// part of the URL; otherwise, the schema checker interprets the URL as being a relative one, as shown in Figure 1.3. Rel- ative URLs are not permitted in XSD Schema. The output from validating Book.xml, using Book.xsd, is shown in Figure 1.4. XSV is undergoing continuing development. At this writing, not all parts of the W3C Recommendation are supported. The download page mentioned earlier provides details of areas not yet fully implemented. The W3C schema checker requires that you either make the file(s) available at a URL or upload them by using the online form. If you are unable or unwill- ing to do that, an alternate approach is to download the schema checker that lies behind the W3C schema checking service. Two schema checkers are available for download. One from Henry Thom- son at the University of Edinburgh (also of the W3C XML Schema Working Group) is the basis of the W3C schema checking service. The other download is available from IBM. NOTE
  • 32. Elementary XML Schema 11 Figure 1.2 Using the online schema checker. Figure 1.3 Error message if http:// is omitted. The download version of XML Schema Validator, XSV, corresponds to the online schema checking service at W3C. Further information about downloading XML Schema Validator can be found at www.ltg.ed.ac.uk/~ht/xsv-status.html. To check the validity of the Book.xsd schema, copy it to the XSV directory (or place the directory containing Book.xsd in the PATH) and issue the follow- ing command: xsv -i Book.xsd
  • 33. 12 Chapter 1 Figure 1.4 The result from the W3C online schema validator when validation has been successful. Figure 1.5 Output of validating Book.xsd by using the XSV schema validator. and you will see output like that in Figure 1.5. Note that there are zero schema errors.
  • 34. Elementary XML Schema 13 Alternatively, you can issue the command xsv -o output.xml -s xsv.xsl -i Book.xsd And, if you have MSXML3 installed, you will see output similar to the display of the output file output.xml, as shown in Figure 1.6. The IBM XML Schema Quality Checker can be downloaded from www.alphaworks.ibm.com/tech/xmlsqc. The IBM XML Schema Quality Checker checks whether or not an XSD schema corresponds to the W3C Rec- ommendation. It does not, at least at this writing, validate instance documents against the XSD schema. As well as standalone schema validation tools such as those just described schemas can be validated by using schema authoring tools. Schema Authoring Tools XSD Schemas can be created by using any XML editor, but editors that are not XSD Schema-aware are limited as learning and production tools. They can spot basic XML syntax errors and can indicate that the syntax is well-formed, but are incapable of providing information about the correctness or incorrect- ness of a schema you have created. Therefore, you would be well-advised to consider, if you have not already done so, acquiring a schema editor such as Turbo XML (from TIBCO Extensibility) or XML Spy (from Altova). Both have free evaluation downloads available from their respective Web sites. Turbo XML Figure 1.6 Using XSV schema validator and an XSLT stylesheet to generate an output file, output.xml.
  • 35. 14 Chapter 1 can be downloaded from www.extensibility.com/downloads/trial_down- loads.htm, and XML Spy can be downloaded from www.xmlspy.com/ . Turbo XML is available for various flavors of 32-bit Windows operating sys- tems, multiple flavors of Unix and for Mac OS X. Occasionally version 2.2.1 overlooks schema errors correctly identified by XML Spy. If you have Turbo XML version 2.2.1 running, you might find that you cannot start the Netscape 6 browser. If you use Netscape 6, start the browser before starting Turbo XML. The generally available version of XML Spy at this writing is version 4.0. Version 3.5 does not use the final XSD Schema namespace. XML Spy Version 4 supports the full XSD (W3C XML) Schema Recommendation. XML Spy is generally easy to use. One irritation with XML Spy 4.0 is that it reformats code, however. For example, it introduces tabs instead of spaces. In addition, occasional spurious error messages are produced. Despite the minor problems just mentioned, both Turbo XML and XML Spy are powerful and useful tools for XSD Schema development. Each is capable of validating an instance document against a schema as well as validating an XSD schema for conformity to the W3C XML Schema Recommendation. XML Schema Document In this section, we will look briefly at the general structure of an XML Schema schema such as the one that you saw earlier in Listing 1.2. The description of each part of a schema document will be brief, and many points will be devel- oped in greater depth in later chapters. An XSD Schema document begins, optionally, with an XML declaration with required version attribute and optional encoding and standalone attributes: <?xml version="1.0" encoding="UTF-8"?> Then follows the <xsd:schema> element, which is the element root of all XSD Schema documents. On the <xsd:schema> element, there is a namespace declaration for the XSD Schema namespace: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > If you see an XSD schema where the namespace declaration refers to www.w3.org/2000/10/XMLSchema, that indicates that the schema was created by using a non-final version of the specification. <xsd:annotation> <xsd:documentation> NOTE NOTE T E A M F L Y
  • 36. Elementary XML Schema 15 This is a sample XML Schema for Chapter 1 of XML Schema Essentials. </xsd:documentation> </xsd:annotation> Optionally, you can include an <xsd:annotation> element nested as above— within which you can include descriptive information indicating the purpose of the schema or otherwise documenting it. The content of <xsd:documenta- tion> elements are intended for use by human readers. <xsd:element name="Book"> <xsd:complexType> <xsd:sequence> <xsd:element name="Title" ref="Title"/> <xsd:element name="Authors" ref="Authors"/> <xsd:element name="Publisher" ref="Publisher"/> </xsd:sequence> <xsd:attribute name="pubCountry" type="xsd:string"/> </xsd:complexType> </xsd:element> An XSD schema will typically include a number of element declarations, such as the element declaration for the <Book> element shown earlier. In this example, the <Book> element is to have complex content; that is, either child elements, an attribute, or both are permitted or required for the <Book> ele- ment in an instance document. The presence of complex content is indicated by the <complexType> element. We will return to examine how to define com- plex types a little later. <xsd:element name="Title" type="xsd:string"/> An element declaration can simply associate an element name—in this case, “Title” with a built-in datatype, in the earlier code, xsd:string. <xsd:element name="Authors"> <xsd:complexType> <xsd:sequence> <xsd:element name="Author" ref="Author" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Author" type="xsd:string"/> <xsd:element name="Publisher" type="xsd:string"/> </xsd:schema> The final section of the XSD schema contains other element declarations and is completed by the end tag, </xsd:schema>.
  • 37. 16 Chapter 1 As we move through the chapter, we will examine other foundational struc- tures in XSD schemas. Root of an XML Schema Document The root of all W3C XML Schema documents is the <xsd:schema> element. A namespace declaration within the <xsd:schema> element associates it with the W3C XML Schema namespace: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> Of course, if you are using the xsd prefix, then a namespace declaration is essential if the namespace prefix is to conform to the requirements of the Namespaces in XML Recommendation and to be processed by applications that implement that recommendation. You might also see the namespace prefix xs associated with the W3C XML Schema namespace. Declaring the Location of Your XML Schema Document The instance document that you saw in Listing 1.1 made no reference to being associated with any particular schema. There is no direct equivalent to the DTD of XML 1.0. XSD Schema uses a more indirect approach. For the moment, we will look at how we associate an instance document that does not use namespaces with an applicable schema document. Listing 1.3 shows how this job can be done. <?xml version="1.0"?> <Book pubCountry="USA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:My WritingXML Schema EssentialsCh01Book.xsd"> <Title>XML Schema Essentials</Title> <Authors> <Author>R. Allen Wyke</Author> <Author>Andrew Watt</Author> </Authors> <Publisher>John Wiley</Publisher> </Book> Listing 1.3 Instance document that does not use namespaces (Book02.xml).
  • 38. Elementary XML Schema 17 The association of an instance document is a two-stage process. The name- space declaration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" associates the namespace prefix xsi with the URI shown. The xsi:noName- spaceSchemaLocation attribute, which belongs to the namespace http://www.w3.org/2001/XMLSchema-instance indicates the location of the schema. The xsi:noNamespaceSchemaLocation attribute can only be used when the xsi namespace prefix has been declared. The value of the noNamespaceSchemaLocation attribute indicates the location of the schema. In the case of this example, the schema is located on drive C: at the location indicated: C:My WritingXML Schema EssentialsCh01Book.xsd XSD Schema processors are free to ignore or to override the schema sug- gested by using the mechanism just described. Declaring Elements and Defining Types Because XML instance documents contain one (and typically many more) ele- ment(s), one of the foundational techniques of W3C XML Schema is the decla- ration of elements. In XML Schema, there is a substantive difference between declaring an ele- ment that has content that is either a simple type or complex type and is per- mitted to occur in an instance document and defining a new type, which can be either simple type or complex type. The terms definition and declaration in XML Schema have no close relation to the terms Document Type Definition and Document Type Declaration of XML 1.0. First, let’s look at how we declare an element the content of which is of sim- ple type in an instance document. Defining Simple Types Elements that contain other elements or that possess attributes are termed complex types, and we will discuss them in the next section. Elements that have NOTE
  • 39. 18 Chapter 1 neither child elements nor possess attributes are termed simple types, and we will discuss these in this section. All attributes have simple type content. XSD Schema provides three flavors of simple types: 1. Atomic types 2. List types 3. Union types Each of these is discussed in the paragraphs that follow. XSD Schema sim- ple types will be discussed in detail in Chapter 4, “Applying Datatypes.” Simple types can be either those simple types, such as xsd:string, built into the XML Schema language or can be simple types created by a schema author by using techniques which we will describe later. All simple types created by a schema author are derived datatypes. Those datatypes built into XSD Schema include both primitive datatypes and derived datatypes. Those datatypes are fully described in Part 2 of the W3C XML Schema Recommendation. Atomic (Simple) Types Let’s assume that we wanted to describe the title and authors of this book in XML. A first, crude attempt at an instance document might look like the fol- lowing (SimpleBook01.xml). As you can see, the structure of the document is poor, but a schema for such an instance document could be created by only declaring a single element of simple type, as shown in Listing 1.5 (SimpleBook01.xsd). This code declares an element <Book> whose type is one of the built-in primitive types of XSD Schema, xsd:string. <?xml version='1.0'?> <Book> XML Schema Essentials, R. Allen Wyke, Andrew Watt, Wiley, USA </Book> Listing 1.4 A first attempt at an instance document (SimpleBook01.xml). <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="Book" type="xsd:string"/> </xsd:schema> Listing 1.5 A schema for Listing 1.4 (SimpleBook01.xsd).
  • 40. Elementary XML Schema 19 You will recognize the XML declaration and the <xsd:schema> element. To declare an element with simple type content, we simply use an <xsd:ele- ment>. The name attribute and the type attribute on the <xsd:element> serve to associate the element type name of the <Book> element in an instance docu- ment and its permitted datatype, xsd:string. We will go on to further develop the structure of an instance document later in the chapter. From the point of view of XSD Schema, an atomic simple type is indivisible. An xsd:string, as far as XSD Schema is concerned, cannot be split into simpler types. Such indivisibility applies to both in-built simple types and to derived simple types. Let’s suppose that we have a European-based e-commerce operation that sells to the United Kingdom, France, and Germany only. The shipping address part of an invoice or purchase order might look like Listing 1.6. A schema for the code from Listing 1.6 is shown in Listing 1.7. The point of interest relating to atomic simple types relates to the <xsd:simpleType name=”CountryType”> element towards the end of the following schema. In the declaration for the <CountryType> element, we indicate that the datatype is a named type that is defined by using the <xsd:simpleType> ele- ment. The value of the CountryType contained in the <Country> element in the instance document is “DE”, meaning Deutschland (Germany). This type is atomic because we cannot take one of its constituent letters and maintain some of the meaning. The meaning is related to the two-letter code for Ger- many in this example. List (Simple) Types A list type in XSD Schema is made up of a sequence of atomic types. There are no built-in list types in XSD Schema, so we must define a list type if we wish to <ShippingAddress type="EUAddress"> <Name> <FirstName>Hans</FirstName> <LastName>Schmidt</LastName> </Name> <Address> <Street>123 Hallgarten</Street> <City>Berlin</City> <PostalCode>12345</PostalCode> <Country>DE</Country> </Address> </ShippingAddress> Listing 1.6 Shipping address part of invoice (ShippingAddress.xml).
  • 41. 20 Chapter 1 <?xml version='1.0'?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="ShippingAddress"> <xsd:complexType> <xsd:sequence> <xsd:element name="Name" type="NameType"/> <xsd:element name="Address" type="AddressType"/> </xsd:sequence> <xsd:attribute name="type" type="xsd:string"/> </xsd:complexType> </xsd:element> <xsd:complexType name="NameType"> <xsd:sequence> <xsd:element name="FirstName" type="xsd:string"/> <xsd:element name="LastName" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="AddressType"> <xsd:sequence> <xsd:element name="Street" type="xsd:string"/> <xsd:element name="City" type="xsd:string"/> <xsd:element name="PostalCode" type="PostalCodeType"/> <xsd:element name="Country" type="CountryType"/> </xsd:sequence> </xsd:complexType> <xsd:simpleType name="PostalCodeType"> <xsd:restriction base="xsd:integer"> <xsd:length value="5" /> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="CountryType"> <xsd:restriction base="xsd:string"> <xsd:length value="2"/> </xsd:restriction> </xsd:simpleType> </xsd:schema> Listing 1.7 A schema for Listing 1.7 (ShippingAddress.xsd). use one. For example, we could define a list type called SouthEastStatesType, which is a list type consisting of the values “FL LA GA SC.” The list type has four string values (each of which happens to be two characters long) that are separated by a space.
  • 42. Elementary XML Schema 21 So, we could have an element <SouthEastStates> as follows: <SouthEastStates>FL LA GA SC</SouthEastStates> This element uses the SouthEastStatesType simple type. If we wanted to define a new simple type, we could use the following code: <xsd:simpleType name="SouthEastStatesType"> <xsd:list itemType="xsd:string"/> </xsd:simpleType> A simple instance document is shown in Listing 1.8. An XSD schema for Listing 1.8 is shown in Listing 1.9. The <xsd:element> element is the declaration that associates the <SouthEast- States> element with the datatype SouthEastStatesType. The <xsd:simple- Type> element is the definition of the datatype SouthEastStatesType. In order to create a list simple type, we need to nest an <xsd:list> element within the <xsd:simpleType> element. The base type for a list is known as its itemType. It is possible to define list types based on the xsd:string type. The xsd:string type might contain space characters or other whitespace characters, however, which are the separators for the individual items in a list type. So, you NOTE <?xml version='1.0'?> <SouthEastStates> FL LA GA SC </SouthEastStates> Listing 1.8 Simple instance document for four southeastern states (SouthEastern- States.xml). <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="SouthEastStates" type="SouthEastStatesType"/> <xsd:simpleType name="SouthEastStatesType"> <xsd:list itemType="xsd:string"/> </xsd:simpleType> </xsd:schema> Listing 1.9 A schema for Listing 1.8 (SouthEasternStates.xsd).
  • 43. 22 Chapter 1 should be careful when attempting to use the xsd:string type as the base type for a list simple type. Let’s look briefly at the kind of problems that can arise when using strings that include whitespace. For example, if we had a simple list datatype NorthAmericanCountriesType defined as follows, <xsd:simpleType name="NorthAmericanCountriesType"> <xsd:list itemType="xsd:string"/> </xsd:simpleType> and we had an element, <NorthAmericanCountries>, which used the NorthAmer- icanCountriesType datatype with content like the following, <NorthAmericanCountries>United States of America Canada Mexico</NorthAmericanCountries> this code would be treated in XSD Schema as a list of six items, not as three countries as you might expect. The first item in the list would be the string “United,” followed by a whitespace character. The second item in the list would be “States,” again separated from the third item, “of,” by a whitespace character (and so on). To avoid this type of problem, avoid the use of spaces if you are using the xsd:string datatype, or use more appropriate datatypes as list members. Simple datatypes are discussed further in Chapter 4. Union (Simple) Types Union datatypes are always derived datatypes. In XSD Schema, there are no built-in union datatypes. The maxOccurs attribute uses a union simple datatype, however, as shown in the following code snippet: <xsd:attribute name="maxOccurs"> <xsd:simpleType> <xsd:union> <xsd:simpleType> <xsd:restriction base='xsd:nonNegativeInteger'/> </xsd:simpleType> <xsd:simpleType> <xsd:restriction base='xsd:string'> <xsd:enumeration value='xsd:unbounded'/> </xsd:restriction> </xsd:simpleType> </xsd:union> </xsd:simpleType> </xsd:attribute>
  • 44. Elementary XML Schema 23 The permitted values of the maxOccurs attribute are any non-negative inte- ger (in other words, any value of type of xsd:nonNegativeInteger) unioned with the string value of “unbounded.” A union datatype has memberTypes. In the example you have just seen for the maxOccurs attribute, the memberTypes are xsd:nonNegativeInteger and the anonymous datatype derived from xsd:string by restriction. The default evaluation of memberTypes is that they are evaluated in the order given in the schema. Evaluation ceases once a first matching member- Type is found. The order of evaluation can be overridden by the xsi:type attribute. Having looked at how we can define the available simple types and use them in element declarations, let’s move on to look at the situation where an element might have simple type content but also possesses an attribute. Simple Type Content and an Attribute Strictly speaking, we are straying into the territory of complex types—because in XSD Schema terminology, an element possesses an attribute that by defini- tion makes it a complex type in XSD Schema. Thus, if we wanted to create an element that would reflect a selling price for a particular locality, perhaps including local sales tax (Value Added Tax in the European Union, for exam- ple), we would need to be able to create an element like the following: <UKPrice currency="GBP">199.99</UKPrice> The content of the <UKPrice> element is simply of xsd:decimal type. To express that notion, we can use the <xsd:simpleContent> element and then use the <xsd:extension> element with the base type xsd:decimal within which we nest an <xsd:attribute> element to define the currency attribute: <xsd:element name="UKPrice"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:decimal"> <xsd:attribute name="currency" type="xsd:string"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> What we have done with this fairly verbose syntax is to derive a new com- plex type from the built-in simple type of xsd:decimal. The <xsd:complex- Type> element is anonymous, but a named complex type could have been
  • 45. 24 Chapter 1 used if, for example, similar prices in local currency were to be added for a number of European Union countries. If we apply this scenario to our simple book instance document so that it has a PubCountry attribute of the <Book> element, we see the result in Listing 1.10. Adding the PubCountry attribute means that the content of <Book> element is now of complex type. Listing 1.11 shows a schema to describe our modified instance document. As you can see, the mechanism of adding a single attribute to an element that has simple type content is pretty verbose in XSD Schema. If you follow the nesting within the <xsd:element>, you should grasp the logic. Because an attribute is present, the content in XSD Schema is complex type; therefore, we use the <xsd:complexType> element. The content of the <Book> element is a simple datatype, and therefore we use the <xsd:simpleContent> element. As well as the simple type content, however, an attribute is also present. Thus, the simple type content is extended, which is shown by the presence of the <xsd:extension> element. The specific nature of the extension is an attribute signaled by the presence of an <xsd:attribute> element nested within the <xsd:extension> element. <?xml version='1.0'?> <Book PubCountry="USA"> XML Schema Essentials, R. Allen Wyke, Andrew Watt, Wiley </Book> Listing 1.10 Adding an attribute to the <Book> element (SimpleBook02.xml). <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="Book"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="PubCountry" type="xsd:string"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:schema> Listing 1.11 A schema to reflect the added PubCountry attribute (SimpleBook02.xsd). T E A M F L Y
  • 46. Elementary XML Schema 25 This example is a special case of a complex type. Let’s move on to introduce how to define complex types. Defining Complex Types In the terminology of XML Schema, an element that either has child elements (sometimes called subelements) or that possesses attributes is termed a com- plex type. A type that possesses neither child elements nor attributes is termed a simple type. A complex type definition will typically contain one or more element decla- rations, element references, and/or attribute declarations. Elements are declared by using the <xsd:element> element, and attributes are declared by using the <xsd:attribute> element. A declaration, whether of an element or of an attribute, is not (strictly speaking) a type but is an association between a name and a set of constraints on the appearance of that name in the XML document governed by the rele- vant schema that contains the name. XSD Schema provides mechanisms for us to define anonymous and named complex types. First, let’s take a look at how we define anonymous complex types. Anonymous Complex Types Anonymous complex types, as you might guess, are complex types that have no name. In creating an anonymous complex type, typically an <xsd:complex- Type> element will be nested within an <xsd:element> element. For example, in an invoice we might typically specify each line item which was purchased and which is being billed. Listing 1.12 shows a simplified invoice. The schema that corresponds to SimpleInvoice.xml is shown in Listing 1.13. The schema contains both anonymous and named complex types, but we will focus on the anonymous types in the meantime. The declaration for the <SimpleInvoice> element has nested within it the definition of an anonymous complex type as shown here: <xsd:element name="SimpleInvoice"> <xsd:complexType> <xsd:sequence> <xsd:element name="Customer" type="CustomerType"/> <xsd:element name="LineItems" type="LineItemsType"/> </xsd:sequence> </xsd:complexType> </xsd:element>
  • 47. 26 Chapter 1 <?xml version='1.0'?> <SimpleInvoice> <Customer> <CustomerName>XMML.com</CustomerName> </Customer> <LineItems> <LineItem quantity="2">Mandrake Linux version 8</LineItem> <LineItem quantity="1">IBM WebSphere Studio Workbench version 4</LineItem> </LineItems> </SimpleInvoice> Listing 1.12 A simple invoice (SimpleInvoice.xml). Notice that we declare an element named “SimpleInvoice.” We define the type for a <SimpleInvoice> element in an anonymous complex type by means of a nested anonymous <xsd:complexType> element; that is, an <xsd:com- plexType> element that lacks a name attribute. The complex type is defined by means of an <xsd:sequence> element as a sequence of <Customer> and <LineItems> elements. The declaration of the <LineItem> element also contains an anonymous complex type definition. You will perhaps recognize this definition as similar to the book example shown in Listing 1.11. The <LineItem> element, too, has a single attribute and xsd:string content. Named Complex Types You have seen the anonymous complex type demonstrated. In many uses of XML documents, however, you might well want to use a complex type more than once, for two different purposes, in the same XML document. In an invoice or purchase order, for example, you might want to define and/or declare a complex type for an address structure that can be used both for the billing address and the shipping address. There is unlikely to be any useful purpose served by creating two separate but essentially identical address structures. Reuse of type definitions makes practical sense. XML Schema enables us to create complex types that can be used in the same XML document for more than one purpose by means of the named com- plex type. If you are creating an invoice or purchase order, you are likely to include addresses for the purchaser and the billing party. To create a complex type that would describe such an address, you could use code like that in Listing 1.14.
  • 48. Elementary XML Schema 27 <?xml version='1.0'?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="SimpleInvoice"> <xsd:complexType> <xsd:sequence> <xsd:element name="Customer" type="CustomerType"/> <xsd:element name="LineItems" type="LineItemsType"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="CustomerType"> <xsd:sequence> <xsd:element name="CustomerName" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="LineItemsType"> <xsd:sequence> <xsd:element ref="LineItem" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:element name="LineItem"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="quantity" type="xsd:string"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:schema> Listing 1.13 A schema for Listing 1.12 (SimpleInvoice.xsd). The <xsd:complexType> element contains the information that defines the complex type named “USAddressType.” The element content is defined as a sequence (note the <xsd:sequence> element) of elements with element type names of Name, Street, City, State, and Zip—each having simple type content. We will see in Chapter 8, “Deriving Types,” how we can create new datatypes that constrain the content of the <State> and <Zip> elements to appropriate
  • 49. 28 Chapter 1 <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <!-- NOTE - This is NOT a complete schema! --> <xsd:element name="BillingAddress" type="USAddressType"/> <xsd:element name="ShippingAddress" type="USAddressType"/> <xsd:complexType name="USAddressType" > <xsd:sequence> <xsd:element name="Name" type="xsd:string"/> <xsd:element name="Street" type="xsd:string"/> <xsd:element name="City" type="xsd:string"/> <xsd:element name="State" type="xsd:string"/> <xsd:element name="Zip" type="xsd:decimal"/> </xsd:sequence> <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="USA"/> </xsd:complexType> </xsd:schema> Listing 1.14 A partial schema with a named complex type (USAddress.xsd). derived datatypes. The <xsd:attribute> element indicates the presence on an element of USAddressType of a country attribute. Notice that there are two element declarations declared to be of type USAd- dressType: the declarations for the <BillingAddress> element and the <Ship- pingAddress> element. The type attribute of the <xsd:element> references the appropriate named complex type. Notice that the type of the country attribute is “xsd:NMTOKEN,” which has a fixed value of “USA.” An xsd:NMTOKEN is a derived datatype that is derived from the datatype xsd:token (all lower case). The token derived datatype is itself derived from the normalizedString derived data type. In XML Schema terminology, normalizedString is said to be the base type of token. Let’s get a little more into the jargon of XML Schema. The xsd:token derived type has the value space that is the set of strings that does not contain a line feed (character #xA) or a tab (character #x9), nor is there any leading space or a sequence of two or more spaces within the string. The xsd:NMTOKEN type constrains the allowed characters further because all whitespace characters are disallowed. The NMTOKEN attribute type is defined in the XML 1.0 (Second Edition) Recommendation. NOTE
  • 50. Elementary XML Schema 29 If you wanted to further refine the definition of the USAddressType complex type, you might want to ensure that you only allow five-digit zip codes. You could go partway toward achieving that goal by using the code shown here: <xsd:element name="Zip" type="xsd:decimal" minLength="5" maxLength="5"/> Two named complex types are shown in Listing 1.13 which you saw earlier. The complex datatypes CustomerType and LineItemsType are used in the type attributes of the declaration of the <Customer> element and the <LineItems> element. We can use complex type definitions to add more structure to the simple book example. Listing 1.15 shows a further refinement of the structure of the instance document. You might instantly recognize the content of the <Book> element as being a complex type. We can use an XSD schema as shown in Listing 1.16 to describe the instance document. The schema demonstrates several of the kinds of declarations and defini- tions that you have already seen. The <Book> element is of complex type and makes use of an anonymous complex type definition. The <Title>, <Author>, and <Publisher> elements use element declarations that use the predefined xsd:string simple type. The definition of the <Authors> element again uses an anonymous complex type definition. Using Anonymous or Named Complex Types You might already have grasped the issues involved with choosing when to use an anonymous complex type or a named complex type, but these will be briefly summarized here. There is no rule that says you must use either an anonymous or named complex type in any particular situation. Whether you <?xml version="1.0"?> <Book pubCountry="USA"> <Title>XML Schema Essentials</Title> <Authors> <Author>R. Allen Wyke</Author> <Author>Andrew Watt</Author> </Authors> <Publisher>John Wiley</Publisher> </Book> Listing 1.15 Adding element content to the simple book (SimpleBook03.xml).
  • 51. 30 Chapter 1 <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:annotation> <xsd:documentation> This is a sample XML Schema for Chapter 1 of XML Schema Essentials. </xsd:documentation> </xsd:annotation> <xsd:element name="Book"> <xsd:complexType> <xsd:sequence> <xsd:element name="Title" ref="Title"/> <xsd:element name="Authors" ref="Authors"/> <xsd:element name="Publisher" ref="Publisher"/> </xsd:sequence> <xsd:attribute name="PubCountry" type="xsd:string"/> </xsd:complexType> </xsd:element> <xsd:element name="Title" type="xsd:string"/> <xsd:element name="Authors"> <xsd:complexType> <xsd:sequence> <xsd:element name="Author" ref="Author" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="Author" type="xsd:string"/> <xsd:element name="Publisher" type="xsd:string"/> </xsd:schema> Listing 1.16 A schema containing simple and complex types (SimpleBook03.xsd). use an anonymous complex type or a named complex type is a matter of con- venience and efficiency. If you plan to use a structure more than once in an instance document—for example, an address structure in both the billing address and shipping address part of an invoice—then it makes sense to avoid duplication of decla- rations, declare a named complex type once, and then reference it twice by using the type attribute of the <xsd:element> element.
  • 52. Elementary XML Schema 31 In Chapter 10, “Bringing the Parts Together,”we will look at how we can reuse derived types from other schema documents. In order to be able to reference those type definitions, they must be named.As you will see later, we can also import ele- ment declarations that always include a name attribute on the <xsd:element>. If you plan to use a structure only once, then you need to define the structure once in any case. If you have no plans to use that structure on multiple occa- sions in an instance document, then little useful purpose is served by naming the complex type, declaring it globally, and then referencing it by name. In that situation, you would almost certainly use an anonymous complex type. Mixed Content You might be aware that when using a DTD (which defines a mixed content model), little worthwhile validation can be carried out on an instance docu- ment. The instance document, or a selected part of it that contains mixed con- tent, is allowed to contain both elements and character content—but the DTD cannot say anything about which elements are to be allowed in the mixed con- tent, what order they might be in, or whether there should be any restrictions on where character content is to be allowed. XSD Schema can improve signifi- cantly on what is a significant weakness of the DTD. Let’s suppose that we want routinely to send out a letter to customers, cre- ated from XML, which thanks the customer for an order, details the items pur- chased, and informs the customer of any special offers that we might have available at the time that the letter is sent. An outline of a possible instance document might look like that in Listing 1.17. A full version showing mixed content is shown in Listing 1.18. We needn’t concern ourselves with where, from, or how the information contained in the document was assembled; rather, we simply accept it as an approximation of a finished document. If we were using a DTD as a schema for our instance document, we could say little more than that mixed content was to be allowed. XSD Schema gives <?xml version='1.0'?> <CustomerLetter> <CustomerAddress></CustomerAddress> <Salutation></Salutation> <Thanks></Thanks> <ItemsOrdered></ItemsOrdered> <SpecialOffers></SpecialOffers> </CustomerLetter> Listing 1.17 The skeleton of a customer letter (CustomerLetter01.xml).
  • 53. 32 Chapter 1 <?xml version='1.0'?> <CustomerLetter> <CustomerAddress> <Customer>Siegried Idylls</Customer> <Street>WagnerStrasse 88</Street> <City>Bayreuth</City> <Country>Germany</Country> </CustomerAddress> Dear <Salutation>Richard</Salutation>, <Thanks>XMML.com is grateful to you for the order detailed below and hope that all parts of the order will prove satisfactory.</Thanks> <ItemsOrdered> <Item quantity="2">Some item</Item> <Item quantity="4">Some other item</Item> </ItemsOrdered> We would like to introduce you to some special offers we are currently making available to selected customers only. <SpecialOffers> <SpecialOffer specialPrice="99">Some great bargain</SpecialOffer> <SpecialOffer specialPrice="250">Some other great bargain</SpecialOffer> </SpecialOffers> These very special offers are available only until October 31st, so if you want to take advantage of these contact us immediately to secure this special pricing. </CustomerLetter> Listing 1.18 An instance document illustrating the customer letter (CustomerLetter02.xml). us significantly more control over element content and ordering. Listing 1.19 shows an XSD Schema for the customer letter. The key part of the schema, as far as understanding how to control mixed con- tent by using XSD Schema, is the declaration of the <CustomerLetter> element: <xsd:element name="CustomerLetter" > <xsd:complexType mixed="true"> <xsd:sequence> <xsd:element name="CustomerAddress" type="CustomerAddressType"/> <xsd:element name="Salutation" type="xsd:string"/> <xsd:element name="Thanks" type="xsd:string"/> <xsd:element name="ItemsOrdered" type="ItemsOrderedType"/> <xsd:element name="SpecialOffers" type="SpecialOffersType"/> </xsd:sequence> </xsd:complexType> </xsd:element>
  • 54. Elementary XML Schema 33 <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="CustomerLetter" > <xsd:complexType mixed="true"> <xsd:sequence> <xsd:element name="CustomerAddress" type="CustomerAddressType"/> <xsd:element name="Salutation" type="xsd:string"/> <xsd:element name="Thanks" type="xsd:string"/> <xsd:element name="ItemsOrdered" type="ItemsOrderedType"/> <xsd:element name="SpecialOffers" type="SpecialOffersType"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="CustomerAddressType"> <xsd:sequence> <xsd:element name="Customer" type="xsd:string"/> <xsd:element name="Street" type="xsd:string"/> <xsd:element name="City" type="xsd:string"/> <xsd:element name="Country" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="ItemsOrderedType"> <xsd:sequence> <xsd:element name="Item" minOccurs="1" maxOccurs="unbounded"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="quantity" type="xsd:decimal"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:complexType name="SpecialOffersType"> <xsd:sequence> <xsd:element name="SpecialOffer" minOccurs="2" maxOccurs="unbounded"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="specialPrice" type="xsd:decimal"/> </xsd:extension> Listing 1.19 An XSD Schema for the customer letter (CustomerLetter02.xsd). continues
  • 55. Random documents with unrelated content Scribd suggests to you:
  • 56. reelected the infant Frederick. The contention continued between the rival candidates, with repeated elections. Otho, by flattering the clergy, obtained himself to be crowned at Rome, and assumed the title of Otho IV.; but some of his followers having been killed by the Roman citizens he meditated revenge, and instead of returning to Germany, reconquered certain possessions usurped from the empire by the pope. For this violence Otho was excommunicated by the holy father, who turned his influence in behalf of the youthful Frederick, and procured him to be elected emperor instead. Otho had a quarrel with Philip Augustus, king of France, respecting an old wager between them. Philip, neither believing nor wishing that Otho could attain the imperial dignity, had wagered the best city in his kingdom against whichever he should select of Otho’s baggage horses, if he carried his point. After Otho had achieved it, he seriously demanded the city of Paris from Philip, who quite as seriously refused to deliver up his capital. War ensued, and in the decisive battle of Bovines, called the “battle of the spurs,” from the number of knights who perished, Philip defeated Otho at the head of two hundred thousand Germans. The imperial dragon, which the Germans, in their wars, were accustomed to plant on a great armed chariot with a guard chosen from the flower of the army, fell into the hands of the victors, and the emperor himself barely escaped at the hazard of his life. This battle was fought in August, 1215; and Otho, completely vanquished, retreated upon his devotions, and died in 1218, without issue.[31] The wager, in its consequences so disastrous to the Germans, and so illustrious to the French arms, was made with Philip while Otho was passing through France on his way from the court of England. Collectors of “engraved British portraits,” and the portraits of persons who “come into England,” should look to this. How many illustrated “Grangers” are there with a portrait of Otho IV., earl of York? THE DUKES OF YORK. I.
  • 57. Edmund Plantagenet, surnamed De Langley, from his birth-place, fifth son of king Edward III., was first created earl of Cambridge by his father, and afterwards created duke of York by his nephew, Richard II. He was much influenced by his brother, the duke of Gloucester; and an historian of the period calls him “a soft prince.” It is certain that he had few stirring qualities, and that passive virtues were not valued in an age when they were of little service to contending parties. In 1402, three years after the accession of Henry IV., he died at his manor of Langley, and was interred in the priory there. II. Edward Plantagenet, second duke of York, was son of the first duke, grandson to Edward III., and great uncle to Henry V., by whose side he valiantly fought and perished, in the field of Agincourt, October 25, 1415. III. Richard Plantagenet, third duke of York, nephew of the second duke, and son of Richard earl of Cambridge, who was executed for treason against Henry V., was restored to his paternal honours by Henry VI., and allowed to succeed to his uncle’s inheritance. As he was one of the most illustrious by descent, so he became one of the most powerful subjects through his dignities and alliances. After the death of the duke of Bedford, the celebrated regent of France, he was appointed to succeed him, and with the assistance of the valorous lord Talbot, afterwards earl of Shrewsbury, maintained a footing in the French territories upwards of five years. The incapacity of Henry VI. incited him to urge his claim to the crown of England in right of his mother, through whom he descended from Philippa, only daughter of the duke of Clarence, second son to Edward III.; whereas the king descended from the duke of Lancaster, third son of that monarch. The duke’s superiority of descent, his valour and mildness in various high employments, and his immense possessions, derived through numerous successions, gave him
  • 58. influence with the nobility, and procured him formidable connections. He levied war against the king, and without material loss slew about five thousand of the royal forces at St. Alban’s, on the 22d of May, 1452. This was the first blood spilt in the fierce and fatal quarrel between the rival houses of York and Lancaster, which lasted thirty years, was signalized by twelve pitched battles, cost the lives of eighty princes of the blood, and almost annihilated the ancient nobility of England. After this battle, the duke’s irresolution, and the heroism of Margaret, queen of Henry VI., caused a suspension of hostilities. The leaders on both sides assented to meet in London, and be solemnly reconciled. The duke of York led the queen in solemn procession to St. Paul’s, and the chiefs of one party marched hand in hand with the chiefs of the other. It was a public demonstration of peace, with secret mutual distrust; and an accident aroused the slumbering strife. One of the king’s retinue insulted one of the earl of Warwick’s; their companions fought, and both parties in every county flew to arms. The battle of Bloreheath, in Staffordshire, 23d September, 1459, was won by the Lancastrians. At the battle of Northampton, 10th July, 1560, the Yorkists had the victory, and the king was taken prisoner. A parliament, summoned in the king’s name, met at Westminster, which the duke of York attended; and, had he then seated himself on the throne in the House of Lords, the deadly feud might have been ended by his being proclaimed king; but his coolness and moderation intimidated his friends, and encouraged his enemies. His personal courage was undoubted, but he was deficient in political courage. The parliament deliberated, and though they declared the duke’s title indefeasible, yet they decided that Henry should retain the crown during life. They provided, however, that till the king’s decease the government should be administered by the duke, as the true and lawful heir of the monarchy; and in this arrangement Richard acquiesced. Meanwhile, queen Margaret, with her infant son, appealed to the barons of the north against the settlement in the south, and collected an army with astonishing celerity. The duke of York hastened with five thousand troops to quell what he imagined to be the beginning of an insurrection, and found, near Wakefield, a force
  • 59. of twenty thousand men. He threw himself into Sandal castle, but with characteristic bravery, imagining he should be disgraced by remaining between walls in fear of a female, he descended onto the plain of Wakefield on the 24th of December, and gave battle to the queen, who largely outnumbering his little army, defeated and slew him; and his son, the earl of Rutland, an innocent youth of seventeen, having been taken prisoner, was murdered in cold blood by the lord de Clifford. Margaret caused the duke’s head to be cut off, and fixed on the gates of the city of York, with a paper crown on it in derision of his claim. He perished in the fiftieth year of his age, worthy of a better fate. IV. Edward Plantagenet, fourth duke of York, eldest son of the last, prosecuted his father’s pretensions, and defeated the earl of Pembroke, half brother to Henry VI., at Mortimer’s Cross, in Herefordshire. Shortly afterwards, queen Margaret advanced upon London, and gained a victory over the Yorkists under the earl of Warwick, at the second battle of St. Alban’s, and, at the same time, regained possession of the person of her weak husband. Pressed by the Yorkists, she retreated to the north and the youthful duke, remarkable for beauty of person, bravery, affability, and every popular quality, entered the capital amidst the acclamations of the citizens. Elated by his success, he resolved to openly insist on his claim, and treat his adversaries as rebels and traitors. On the 3d of March, 1460, he caused his army to muster in St. John’s Fields, Clerkenwell; and after an harangue to the multitude surrounding his soldiery, the tumultuary crowd were asked whether they would have Henry of Lancaster, or Edward, eldest son of the late duke of York, for king. Their “sweet voices” were for the latter; and this show of popular election was ratified by a great number of bishops, lords, magistrates, and other persons of distinction, assembled for that purpose at Baynard’s Castle. On the morrow, the duke went to St. Paul’s and offered, and had Te Deum sung, and was with great royalty conveyed to Westminster, and there in the great hall sat in
  • 60. the king’s seat, with St. Edward’s sceptre in his hand. On the 29th of March, 1461, he fought the fierce and bloody battle of Touton, wherein he issued orders to give no quarter, and there were above thirty-six thousand slain. This slaughter confirmed him king of England, and he reigned upwards of twenty years under the title of Edward IV., defiling his fame and power by effeminacy and cruelty. The title of York merged in the royal dignity. V. Richard Plantagenet, of Shrewsbury, fifth duke of York, son of Edward IV., was murdered in the tower while young, with his elder brother, Edward V., by order of their uncle, the duke of Gloucester, afterwards Richard III. VI. Henry Tudor, sixth duke of York, was so created by his father Henry VII., whom he succeeded as king, under the title of Henry VIII., and stained our annals with heartless crimes. VII. Charles Stuart, seventh duke of York, was second son of James I., by whom he was created to that title in 1604, and whom he succeeded in the throne as Charles I. VIII. James Stuart, a younger son of Charles I., was the eighth duke of York. While bearing this title during the reign of his brother Charles II., he manifested great personal courage as a naval commander, in several actions with the Dutch. Under the title of James II., he incompetently filled the throne and weakly abdicated it. IX. Ernest Augustus Guelph, ninth duke of York, duke of Albany, earl of Ulster, and bishop of Osnaburgh, was brother to George Lewis Guelph, elector of Hanover, and king of England as George I., by
  • 61. letters from whom, in 1716, he was dignified as above, and died in 1728, unmarried. X. Edward Augustus, tenth duke of York, duke of Albany, and earl of Ulster, was second son of Frederick prince of Wales, and brother to king George III., by whom he was created to those titles. He died at Monaco, in Italy, September 17, 1767, unmarried. XI. THE LATE DUKE OF YORK. Frederick, eleventh Duke of York, was brother of His Majesty King George IV., and second son of his late Majesty King George III., by whom he was advanced to the dignities of Duke of the Kingdom of Great Britain, and of Earl of the Kingdom of Ireland, by the titles of Duke of York and of Albany in Great Britain, and of Earl of Ulster in Ireland, and presented to the Bishopric of Osnaburgh. His Royal Highness was Commander-in-Chief of all the Land Forces of the United Kingdom, Colonel of the First Regiment of Foot Guards, Colonel-in-chief of the 60th Regiment of Infantry, Officiating Grand Master of the Order of the Bath, High Steward of New Windsor, Warden and Keeper of the New Forest Hampshire, Knight of the Garter, Knight of the Order of the Holy Ghost in France, of the Black Eagle in Russia, the Red Eagle in Prussia, of St. Maria Theresa in Austria, of Charles III. in Spain, Doctor of Civil Law, and Fellow or the Royal Society. The late duke of York was born on the 16th of August, 1763; he died on the 5th of January, 1827. A few miscellaneous memoranda are extracted from journals of the dates they refer to. The duke of York was sent to Germany to finish his education. On the 1st of August, 1787, his royal highness, after having been only five days on the road from Hanover to Calais, embarked at that port, on board a common packet-boat, for England, and arrived at Dover the same afternoon. He was at St. James’s-palace the
  • 62. following day by half-past twelve o’clock; and, on the arrival of the prince of Wales at Carlton-house, he was visited by the duke, after an absence of four years, which, far from cooling, had increased the affection of the royal brothers. On the 20th of December, in the same year, a grand masonic lodge was held at the Star and Garter in Pall-mall. The duke of Cumberland as grand-master, the prince of Wales, and the duke of York, were in the new uniform of the Britannic-lodge, and the duke of York received another degree in masonry; he had some time before been initiated in the first mysteries of the brotherhood. On the 5th of February, 1788, the duke of York appeared in the Court of King’s Bench, and was sworn to give evidence before the grand jury of Middlesex, on an indictment for fraud, in sending a letter to his royal highness, purporting to be a letter from captain Morris, requesting the loan of forty pounds. The grand jury found the indictment, and the prisoner, whose name does not appear, was brought into court by the keeper of Tothill-fields Bridewell, and pleaded not guilty, whereupon he was remanded, and the indictment appointed to be tried in the sittings after the following term; but there is no account of the trial having been had. In December of the same year, the duke ordered two hundred and sixty sacks of coals to be distributed among the families of the married men of his regiment, and the same to be continued during the severity of the weather. In 1788, pending the great question of the regency, it was contended on that side of the House of Commons from whence extension of royal prerogative was least expected, that from the moment parliament was made acquainted with the king’s incapacity, a right attached to the prince of Wales to exercise the regal functions, in the name of his father. On the 15th of December, the duke of York rose in the House of Lords, and a profound silence ensued. His royal highness said, that though perfectly unused as he
  • 63. was to speak in a public assembly, yet he could not refrain from offering his sentiments to their lordships on a subject in which the dearest interests of the country were involved. He said, he entirely agreed with the noble lords who had expressed their wishes to avoid any question which tended to induce a discussion on the rights of the prince. The fact was plain, that no such claim of right had been made on the part of the prince; and he was confident that his royal highness understood too well the sacred principles which seated the house of Brunswick on the throne of Great Britain, ever to assume or exercise any power, be his claim what it might, not derived from the will of the people, expressed by their representatives and their lordships in parliament assembled. On this ground his royal highness said, that he must be permitted to hope that the wisdom and moderation of all considerate men, at a moment when temper and unanimity were so peculiarly necessary, on account of the dreadful calamity which every description of persons must in common lament, but which he more particularly felt, would make them wish to avoid pressing a decision, which certainly was not necessary to the great object expected from parliament, and which must be most painful in the discussion to a family already sufficiently agitated and afflicted. His royal highness concluded with saying, that these were the sentiments of an honest heart, equally influenced by duty and affection to his royal father, and attachment to the constitutional rights of his subjects; and that he was confident, if his royal brother were to address them in his place as a peer of the realm, that these were the sentiments which he would distinctly avow. His majesty in council having declared his consent, under the great seal, to a contract of matrimony between his royal highness the duke of York and her royal highness the princess Frederique Charlotte Ulrique Catherine of Prussia, eldest daughter of the king of Prussia, on the 29th of September, 1791, the marriage ceremony was performed at Berlin. About six o’clock in the afternoon, all the persons of the blood royal assembled in gala, in the apartments of the dowager queen, where the diamond crown was put on the head of princess Frederica. The generals, ministers, ambassadors, and the
  • 64. high nobility, assembled in the white hall. At seven o’clock, the duke of York, preceded by the gentlemen of the chamber, and the court officers of state, led the princess his spouse, whose train was carried by four ladies of the court, through all the parade apartments; after them went the king, with the queen dowager, prince Lewis of Prussia, with the reigning queen, and others of the royal family to the white hall, where a canopy was erected of crimson velvet, and also a crimson velvet sofa for the marriage ceremony. The royal couple placed themselves under the canopy, before the sofa, the royal family stood round them, and the upper counsellor of the consistory, Mr. Sack, made a speech in German. This being over, rings were exchanged; and the illustrious couple, kneeling on the sofa, were married according to the rites of the reformed church. The whole ended with a prayer. Twelve guns, placed in the garden, fired three rounds, and the benediction was given. The new-married couple then received the congratulations of the royal family, and returned in the same manner to the apartments, where the royal family, and all persons present, sat down to card-tables; after which, the whole court, the high nobility, and the ambassadors, sat down to supper, at six tables. The first was placed under a canopy of crimson velvet, and the victuals served in gold dishes and plates. The other five tables, at which sat the generals, ministers, ambassadors, all the officers of the court, and the high nobility, were served in other apartments. During supper, music continued playing in the galleries of the first hall, which immediately began when the company entered the hall. At the dessert, the royal table was served with a beautiful set of china, made in the Berlin manufactory. Supper being over, the whole assembly repaired to the white hall, where the trumpet, timbrel, and other music were playing; and the flambeau dance was begun, at which the ministers of state carried the torches. With this ended the festivity. The ceremony of the re-marriage of the duke and duchess of York took place at the Queen’s Palace, London, on the 23d of November. The duchess of York died on the 6th of August, 1820.
  • 65. The Dance of Torches. As a note of illustration on this dance at the Prussian nuptials of the duke and duchess of York, reference may be had to a slight mention of the same observance on the marriage of the prince royal of Prussia with the princess of Bavaria, in the Every-Day Book, vol. i. p. 1551. Since that article, I find more descriptive particulars of it in a letter from baron Bielfeld, giving an account of the marriage of the prince of Prussia with the princess of Brunswick Wolfenbuttle, at Berlin, in 1742. The baron was present at the ceremonial. “As soon as their majesties rose from table, the whole company returned into the white hall; from whence the altar was removed, and the room was illuminated with fresh wax lights. The musicians were placed on a stage of solid silver. Six lieutenant generals, and six ministers of state, stood, each with a white wax torch in his hand, ready to be lighted, in conformity to a ceremony used in the German courts on these occasions, which is called ‘the dance of torches,’ in allusion to the torch of Hymen. This dance was opened by the new married prince and princess, who made the tour of the hall, saluting the king and the company. Before them went the ministers and the generals, two and two, with their lighted torches. The princess then gave her hand to the king, and the prince to the queen; the king gave his hand to the queen mother, and the reigning queen to prince Henry; and in this manner all the princes and princesses that were present, one after the other, and according to their rank, led up the dance, making the tour of the hall, almost in the step of the Polognese. The novelty of this performance, and the sublime quality of the performers, made it in some degree agreeable. Otherwise the extreme gravity of the dance itself, with the continual round and formal pace of the dancers, the frequent going out of the torches, and the clangour of the trumpets that rent the ear, all these I say made it too much resemble the dance of the Sarmates, those ancient inhabitants of the prodigious woods of this country.”
  • 66. On the 7th of June, 1794, about four o’clock in the morning, a fire broke out at the duke of York’s palace at Oatlands. It began in the kitchen, and was occasioned by a beam which projected into the chimney, and communicated to the roof. His royal highness’s armoury was in that wing of the building where the fire commenced, in which forty pounds of gunpowder being deposited, a number of most curious war-like instruments, which his royal highness had collected on the continent, were destroyed. Many of the guns and other weapons were presented from the king of Prussia, and German officers of distinction, and to each piece was attached its history. By the seasonable exertions of the neighbourhood, the flames were prevented from spreading to the main part of the building. The duchess was at Oatlands at the time, and beheld the conflagration from her sleeping apartment, in the centre of the mansion, from which the flames were prevented communicating by destroying a gateway, over the wing that adjoined to the house. Her royal highness gave her orders with perfect composure, directed abundant refreshment to the people who were extinguishing the flames, and then retired to the rooms of the servants at the stables, which are considerably detached from the palace. His majesty rode over from Windsor-castle to visit her royal highness, and staid with her a considerable time. On the 8th of April, 1808, whilst the duke of York was riding for an airing along the King’s-road towards Fulham, a drover’s dog crossed, and barked in front of the horse. The animal, suddenly rearing, fell backwards, with the duke under him; and the horse rising, with the duke’s foot in the stirrup, dragged him along, and did him further injury. When extricated, the duke, with great cheerfulness, denied he was much hurt, yet two of his ribs were broken, the back of his head and face contused, and one of his legs and arms much bruised. A gentleman in a hack chaise immediately alighted, and the duke was conveyed in it to York-house, Piccadilly, where his royal highness was put to bed, and in due time recovered to the performance of his active duties.
  • 67. On the 6th of August, 1815, the duke of York, on coming out of a shower-bath, at Oatlands, fell, from the slippery state of the oilcloth, and broke the large bone of his left arm, half way between the shoulder and the elbow-joint. His royal highness’s excellent constitution at that time assisted the surgeons, and in a fortnight he again attended to business. On the 11th of October, in the same year, his royal highness’s library, at his office in the Horse-guards consisting of the best military authors, and a very extensive collection of maps, were removed to his new library (late her majesty’s) in the Green-park. The assemblage is the most perfect collection of works on military affairs in the kingdom. It appears, from the report of the commissioners of woods, forests, and land revenues, in 1816, that the duke of York purchased of the commissioners the following estates: 1. The manor of Byfleet and Weybridge, with Byfleet or Weybridge-park, and a capital messuage and offices, and other messuages and buildings there. 2. The manor of Walton Leigh, and divers messuages and lands therein. 3. A capital messuage called Brooklands, with offices, gardens, and several parcels of land, situated at Weybridge. 4. A farm-house, and divers lands, called Brooklands-farm, at Weybridge. 5. A messuage and lands, called Childs, near Weybridge. 6. Two rabbit-warrens within the manor of Byfleet and Weybridge. To this property was to be added all lands and premises allotted to the preceding by virtue of any act of enclosure. The sale was made to his royal highness in May, 1809, at the price of £74,459. 3s.; but the money was permitted to remain at the interest of 31⁄2 per cent. till the 10th of June, 1815, when the principal and interest (amounting, after the deduction of property-tax, and of the rents, which, during the interval, had been paid to the crown, to £85,135. 5s. 9d.) were paid into the Bank of England, to the account of the commissioners for the new street. His royal highness also purchased about twenty acres of land in Walton, at the price of £1294. 2s. 3d.
  • 68. While the duke was in his last illness, members on both sides of the House of Commons bore spontaneous testimony to his royal highness’s impartial administration of his high office as commander- in-chief; and united in one general expression, that no political distinction ever interfered to prevent the promotion of a deserving officer. A statement in bishop Watson’s Memoirs, is a tribute to his royal highness’s reputation. “On the marriage of my son in August, 1805, I wrote,” says the bishop, “to the duke of York, requesting his royal highness to give him his protection. I felt a consciousness of having, through life, cherished a warm attachment to the house of Brunswick, and to those principles which had placed it on the throne, and of having on all occasions acted an independent and honourable part towards the government of the country, and I therefore thought myself justified in concluding my letter in the following terms:—‘I know not in what estimation your royal highness may hold my repeated endeavours, in moments of danger, to support the religion and the constitution of the country; but if I am fortunate enough to have any merit with you on that score, I earnestly request your protection for my son. I am a bad courtier, and know little of the manner of soliciting favours through the intervention of others, but I feel that I shall never know how to forget them, when done to myself; and, under that consciousness, I beg leave to submit myself ‘Your Royal Highness’s ‘Most grateful servant, ‘R. Landaff.’ “I received a very obliging answer by the return of the post, and in about two months my son was promoted, without purchase, from a majority to a lieutenant-colonelcy in the Third Dragoon Guards. After having experienced, for above twenty-four years, the neglect of his majesty’s ministers, I received great satisfaction from this attention of his son, and shall carry with me to my grave a most grateful memory of his goodness. I could not at the time forbear expressing my acknowledgment in the following letter, nor can I now forbear inserting it in these anecdotes. The whole transaction will do
  • 69. his royal highness no discredit with posterity, and I shall ever consider it as an honourable testimony of his approbation of my public conduct. ‘Calgarth Park, Nov. 9, 1805.’ ——— ‘Do, my lord of Canterbury, But one good turn, and he’s your friend for ever.’ ‘Thus Shakspeare makes Henry VIII. speak of Cranmer; and from the bottom of my heart, I humbly entreat your royal highness to believe, that the sentiment is as applicable to the bishop of Landaff as it was to Cranmer. ‘The bis dat qui cito dat has been most kindly thought of in this promotion of my son; and I know not which is most dear to my feelings, the matter of the obligation, or the noble manner of its being conferred. I sincerely hope your royal highness will pardon this my intrusion, in thus expressing my most grateful acknowledgments for them both. ‘R. Landaff.’”
  • 70. [31] Hist. of House of Austria. Rapin. Favine. Mr. Charles Lamb. To the Editor. Dear Sir, It is not unknown to you, that about sixteen years since I published “Specimens of English Dramatic Poets, who lived about the Time of Shakspeare.” For the scarcer Plays I had recourse to the Collection bequeathed to the British Museum by Mr. Garrick. But my time was but short, and my subsequent leisure has discovered in it a treasure rich and exhaustless beyond what I then imagined. In it is to be found almost every production in the shape of a Play that has appeared in print, from the time of the old Mysteries and Moralities to the days of Crown and D’Urfey. Imagine the luxury to one like me, who, above every other form of Poetry, have ever preferred the Dramatic, of sitting in the princely apartments, for such they are, of poor condemned Montagu House, which I predict will not speedily be followed by a handsomer, and culling at will the flower of some thousand Dramas. It is like having the range of a Nobleman’s Library, with the Librarian to your friend. Nothing can exceed the courteousness and attentions of the Gentleman who has the chief direction of the Reading Rooms here; and you have scarce to ask for a volume, before it is laid before you. If the occasional Extracts, which I have been tempted to bring away, may find an appropriate place in your Table Book, some of them are weekly at your service. By those who remember the “Specimens,” these must be considered as mere after-gleanings, supplementary to that work, only comprising a longer period. You must be content with sometimes a scene, sometimes a song; a speech, or passage, or a poetical image, as they happen to strike me. I read without order of time; I am a poor hand at dates; and for any biography of the Dramatists, I must
  • 71. refer to writers who are more skilful in such matters. My business is with their poetry only. Your well-wisher, C. Lamb. January, 27, 1827. Garrick Plays. No. I. [From “King John and Matilda,” a Tragedy by Robert Davenport, acted in 1651.] John, not being able to bring Matilda, the chaste daughter of the old Baron Fitzwater, to compliance with his wishes, causes her to be poisoned in a nunnery. Scene. John. The Barons: they being as yet ignorant of the murder, and having just come to composition with the King after tedious wars. Matilda’s hearse is brought in by Hubert.
  • 72. John. Hubert, interpret this apparition. Hubert. Behold, sir, A sad-writ Tragedy, so feelingly Languaged, and cast; with such a crafty cruelty Contrived, and acted; that wild savages Would weep to lay their ears to, and (admiring To see themselves outdone) they would conceive Their wildness mildness to this deed, and call Men more than savage, themselves rational. And thou, Fitzwater, reflect upon thy name,[32] And turn the Son of Tears. Oh, forget That Cupid ever spent a dart upon thee; That Hymen ever coupled thee; or that ever The hasty, happy, willing messenger Told thee thou had’st a daughter. Oh look here! Look here, King John, and with a trembling eye Read your sad act, Matilda’s tragedy. Barons. Matilda! Fitzwater. By the lab’ring soul of a much-injured man, It is my child Matilda! Bruce. Sweet niece! Leicester. Chaste soul! John. Do I stir, Chester? Good Oxford, do I move? stand I not still To watch when the griev’d friends of wrong’d Matilda Will with a thousand stabs turn me to dust, That in a thousand prayers they might be happy? Will no one do it? then give a mourner room, A man of tears. Oh immaculate Matilda, These shed but sailing heat-drops, misling showers The faint dews of a doubtful April morning; But from mine eyes ship-sinking cataracts, Whole clouds of waters, wealthy exhalations, Shall fall into the sea of my affliction, Till it amaze the mourners. Hubert. Unmatch’d Matilda; Celestial soldier, that kept a fort of chastity ’Gainst all temptations. Fitzwater. Not to be a Queen, Would she break her chaste vow. Truth crowns your reed; Unmatch’d Matilda was her name indeed. John. O take into your spirit-piercing praise My scene of sorrow. I have well-clad woes,
  • 73. My scene of sorrow. I have well clad woes, Pathetic epithets to illustrate passion, And steal true tears so sweetly from all these, Shall touch the soul, and at once pierce and please. [Peruses the Motto and Emblems on the hearse. “To Piety and Purity”—and “Lillies mix’d with Roses”— How well you have apparell’d woe! this Pendant, To Piety and Purity directed, Insinuates a chaste soul in a clean body, Virtue’s white Virgin, Chastity’s red Martyr! Suffer me then with this well-suited wreath To make our griefs ingenious. Let all be dumb, Whilst the king speaks her Epicedium. Chester. His very soul speaks sorrow. Oxford. And it becomes him sweetly. John. Hail Maid and Martyr! lo on thy breast, Devotion’s altar, chaste Truth’s nest, I offer (as my guilt imposes) Thy merit’s laurel, Lillies and Roses; Lillies, intimating plain Thy immaculate life, stuck with no stain; Roses red and sweet, to tell How sweet red sacrifices smell. Hang round then, as you walk about this hearse, The songs of holy hearts, sweet virtuous verse. Fitzwater. Bring Persian silks, to deck her monument; John. Arabian spices, quick’ning by their scent; Fitzwater. Numidian marble, to preserve her praise, John. Corinthian ivory, her shape to praise: Fitzwater. And write in gold upon it, In this breast Virtue sate mistress, Passion but a guest. John. Virtue is sweet; and, since griefs bitter be, Strew her with roses, and give rue to me. Bruce. My noble brother, I’ve lost a wife and son;[33] You a sweet daughter. Look on the king’s penitence; His promise for the public peace. Prefer A public benefit.[34] When it shall please, Let Heaven question him. Let us secure And quit the land of Lewis.[35] Fitzwater. Do any thing; Do all things that are honorable; and the Great King Make you a good king, sir! and when your soul Shall at any time reflect upon your follies, Good King John, weep, weep very heartily;
  • 74. g , p, p y y; It will become you sweetly. At your eyes Your sin stole in; there pay your sacrifice. John. Back unto Dunmow Abbey. There we’ll pay To sweet Matilda’s memory, and her sufferings, A monthly obsequy, which (sweet’ned by The wealthy woes of a tear-troubled eye) Shall by those sharp afflictions of my face Court mercy, and make grief arrive at grace. Song. Matilda, now go take thy bed In the dark dwellings of the dead; And rise in the great waking day Sweet as incence, fresh as May. Rest there, chaste soul, fix’d in thy proper sphere, Amongst Heaven’s fair ones; all are fair ones there. Rest there, chaste soul, whilst we here troubled say: Time gives us griefs, Death takes our joys away. This scene has much passion and poetry in it, if I mistake not. The last words of Fitzwater are an instance of noble temperament; but to understand him, the character throughout of this mad, merry, feeling, insensible-seeming lord, should be read. That the venomous John could have even counterfeited repentance so well, is out of nature; but supposing the possibility, nothing is truer than the way in which it is managed. These old playwrights invested their bad characters with notions of good, which could by no possibility have coexisted with their actions. Without a soul of goodness in himself, how could Shakspeare’s Richard the Third have lit upon those sweet phrases and inducements by which he attempts to win over the dowager queen to let him wed her daughter. It is not Nature’s nature, but Imagination’s substituted nature, which does almost as well in a fiction. (To be continued.) [32] Fitzwater: son of water. A striking instance of the compatibility of the serious pun with the expression of the profoundest sorrows. Grief, as well as joy, finds ease in thus playing with a word. Old John of Gaunt in Shakspeare thus descants on his name: “Gaunt, and gaunt indeed;” to a
  • 75. long string of conceits, which no one has ever yet felt as ridiculous. The poet Wither thus, in a mournful review of the declining estate of his family, says with deepest nature:— The very name of Wither shows decay. [33] Also cruelly slain by the poisoning John. [34] i. e. of peace; which this monstrous act of John’s in this play comes to counteract, in the same way as the discovered Death of Prince Arthur is like to break the composition of the King with his Barons in Shakspeare’s Play. [35] The Dauphin of France, whom they had called in, as in Shakspeare’s Play. Literature. Glances at New Books on my Table. “Constable’s Miscellany of original and selected Publications” is proposed to consist of various works on important and popular subjects, with the view of supplying certain chasms in the existing stock of useful knowledge; and each author or subject is to be kept separate, so as to enable purchasers to acquire all the numbers, or volumes, of each book, distinct from the others. The undertaking commenced in the first week of the new year, 1827, with the first number of Captain Basil Hall’s voyage to Loo-Choo, and the complete volume of that work was published at the same time. “Early Metrical Tales, including the History of Sir Egeir, Sir Gryme, and Sir Gray-Steill.” Edinb. 1826. sm. 8vo. 9s. (175 copies printed.) The most remarkable poem in this elegant volume is the rare Scottish romance, named in the title-page, which, according to its present editor, “would seem, along with the poems of sir David Lindsay, and the histories of Robert the Bruce, and of sir William Wallace, to have formed the standard productions of the vernacular literature of the country.” In proof of this he adduces several authorities; “and yet it is remarkable enough, that every ancient copy should have hitherto eluded the most active and unremitting
  • 76. research.” The earliest printed edition is presumed to have issued from the press of Thomas Bassandyne, “the first printer of the sacred Scriptures in Scotland.” An inventory of his goods, dated 18th October, 1577, contains an item of three hundred “Gray Steillis,” valued at the “pece VId. summa £VII. x. o.” Its editor would willingly give the sum-total of these three hundred copies for “one of the said Gray-Steillis, were he so fortunate as to meet with it.” He instances subsequent editions, but the only copy he could discover was printed at Aberdeen in 1711, by James Nicol, printer to the town and university; and respecting this, which, though of so recent date, is at present unique, “the editor’s best acknowledgments are due to his friend, Mr. Douce, for the kind manner in which he favoured him with the loan of the volume, for the purpose of republication.” On the 17th of April, 1497, when James IV. was at Stirling: there is an entry in the treasurer’s accounts, “Item, that samyn day to twa Sachelaris that sang Gray Steil to the King, IXs.” In MS. collections made at Aberdeen in 1627, called a “Booke for the Lute,” by Robert Gordon, is the air of “Gray-Steel;” and a satirical poem in Scottish rhyme on the marquis of Argyle, printed in 1686, is “appointed to be sung according to the tune of old Gray Steel.” These evidences that the poem was sung, manifest its popularity. There are conjectures as to who the person denominated Sir Gray Steel really was, but the point is undetermined. In this volume there are thirteen poems. 1. Sir Gray-Steill above spoken of. 2. The Tales of the Priests of Peblis, wherein the three priests of Peebles, having met to regale on St. Bride’s day, agree, each in turn, to relate a story. 3. Ane Godlie Dreame, by lady Culross. 4. History of a Lord and his three Sons, much resembling the story of Fortunatus. 5. The Ring of the Roy Robert, the printed copies of which have been modernized and corrupted. 6. King Estmere, an old romantic tale. 7. The Battle of Harlaw, considered by its present editor “as the original of rather a numerous class of Scotish historical ballads.” 8. Lichtoun’s Dreme, printed for the first time from the Bannatyne MS. 1568. 9. The Murning Maiden, a poem “written in the Augustan age of Scotish poetry.” 10. The Epistill of the Hermeit of Alareit, a satire on the Grey Friers, by Alexander earl
  • 77. of Glencairn. 11. Roswall and Lillian, a “pleasant history,” (chanted even of late in Edinburgh,) from the earliest edition discovered, printed in 1663, of which the only copy known is in the Advocates’ Library, from the Roxburghe sale. 12. Poem by Glassinberry, a name for the first time introduced into the list of early Scotish poets, and the poem itself printed from “Gray’s MS.” 13. Sir John Barleycorn, from a stall-copy printed in 1781, with a few corrections, concerning which piece it is remarked, that Burns’s version “cannot be said to have greatly improved it.” There is a vignette to this ballad, “designed and etched by the ingenious young artist, W. Geikie,” of Edinburgh, from whence I take the liberty to cut a figure, not for the purpose of conveying an idea of this “Allan-a-Maut,” who is surrounded with like “good” company by Mr. Geikie’s meritorious pencil, but to extend the knowledge of Mr. Geikie’s name, who is perfectly unknown to me, except through the single print I refer to, which compels me to express warm admiration of his correct feeling, and assured talent.
  • 78. Besides Mr. Geikie’s beautiful etching, there is a frontispiece by W. H. Lizars from a design by Mr. C. Kirkpatrick Sharpe, and a portrait of Alexander earl of Eglintoune 1670, also by Mr. Lizars, from a curiously illuminated parchment in the possession of the present earl.
  • 79. SAYING NOT MEANING. By William Basil Wake. For the Table Book. Two gentlemen their appetite had fed, When, opening his toothpick-case, one said, “It was not until lately that I knew That anchovies on terrâ firmâ grew.” “Grew!” cried the other, “yes, they grow, indeed, Like other fish, but not upon the land; You might as well say grapes grow on a reed, Or in the Strand!” “Why, sir,” return’d the irritated other, “My brother, When at Calcutta, Beheld them bonâ fide growing; He wouldn’t utter A lie for love or money, sir; so in This matter you are thoroughly mistaken.” “Nonsense, sir! nonsense! I can give no credit To the assertion—none e’er saw or read it; Your brother, like his evidence, should be shaken.” “Be shaken, sir! let me observe, you are Perverse—in short—” “Sir,” said the other, sucking his cigar, And then his port— “If you will say impossibles are true, You may affirm just any thing you please— That swans are quadrupeds, and lions blue, And elephants inhabit Stilton cheese! Only you must not force me to believe What’s propagated merely to deceive.” “Then you force me to say, sir, you’re a fool,” Return’d the bragger. Language like this no man can suffer cool; It made the listener stagger; So, thunder-stricken, he at once replied, “The traveller lied Who had the impudence to tell it you.” “Zounds! then d’ye mean to swear before my face That anchovies don’t grow like cloves and mace?”
  • 80. “I do!” Disputants often after hot debates Leave the contention as they found it—bone, And take to duelling, or thumping têtes; Thinking, by strength of artery, to atone For strength of argument; and he who winces From force of words, with force of arms convinces! With pistols, powder, bullets, surgeons, lint, Seconds, and smelling-bottles, and foreboding, Our friends advanced; and now portentous loading (Their hearts already loaded) serv’d to show It might be better they shook hands—but no; When each opines himself, though frighten’d, right, Each is, in courtesy, oblig’d to fight! And they did fight: from six full measured paces The unbeliever pull’d his trigger first; And fearing, from the braggart’s ugly faces, The whizzing lead had whizz’d its very worst, Ran up, and with a duelistic tear, (His ire evanishing like morning vapours,) Found him possess’d of one remaining ear, Who, in a manner sudden and uncouth, Had given, not lent, the other ear to truth: For, while the surgeon was applying lint, He, wriggling, cried—“The deuce is in’t— Sir! I meant—capers!” Characters. THE OLD GENTLEMAN. Our old gentleman, in order to be exclusively himself, must be either a widower or a bachelor. Suppose the former. We do not mention his precise age, which would be invidious;—nor whether he wears his own hair or a wig; which would be wanting in universality. If a wig, it is a compromise between the more modern scratch and the departed glory of the toupee. If his own hair, it is white, in spite of his favourite grandson, who used to get on the chair behind him, and pull the silver hairs out, ten years ago. If he is bald at top, the
  • 81. hair-dresser, hovering and breathing about him like a second youth, takes care to give the bald place as much powder as the covered; in order that he may convey, to the sensorium within, a pleasing indistinctness of idea respecting the exact limits of skin and hair. He is very clean and neat; and in warm weather is proud of opening his waistcoat half way down, and letting so much of his frill be seen; in order to show his hardiness as well as taste. His watch and shirt- buttons are of the best; and he does not care if he has two rings on a finger. If his watch ever failed him at the club or coffee-house, he would take a walk every day to the nearest clock of good character, purely to keep it right. He has a cane at home, but seldom uses it, on finding it out of fashion with his elderly juniors. He has a small cocked hat for gala days, which he lifts higher from his head than the round one, when made a bow to. In his pockets are two handkerchiefs, (one for the neck at night-time,) his spectacles, and his pocket-book. The pocket-book, among other things, contains a receipt for a cough, and some verses cut out of an odd sheet of an old magazine, on the lovely duchess of A., beginning— When beauteous Mira walks the plain. He intends this for a common-place book which he keeps, consisting of passages in verse and prose cut out of newspapers and magazines, and pasted in columns; some of them rather gay. His principal other books are Shakspeare’s Plays and Milton’s Paradise Lost; the Spectator, the History of England; the works of Lady M. W. Montague, Pope, and Churchill; Middleton’s Geography, the Gentleman’s Magazine; Sir John Sinclair on Longevity; several plays with portraits in character; Account of Elizabeth Canning, Memoirs of George Ann Bellamy, Poetical Amusements at Bath-Easton, Blair’s Works, Elegant Extracts; Junius as originally published; a few pamphlets on the American War and Lord George Gordon, &c. and one on the French Revolution. In his sitting rooms are some engravings from Hogarth and Sir Joshua; an engraved portrait of the Marquis of Granby; ditto of M. le Comte de Grasse surrendering to Admiral Rodney; a humorous piece after Penny; and a portrait of himself, painted by Sir Joshua. His wife’s portrait is in his chamber,
  • 82. looking upon his bed. She is a little girl, stepping forward with a smile and a pointed toe, as if going to dance. He lost her when she was sixty. The Old Gentleman is an early riser, because he intends to live at least twenty years longer. He continues to take tea for breakfast, in spite of what is said against its nervous effects; having been satisfied on that point some years ago by Dr. Johnson’s criticism on Hanway, and a great liking for tea previously. His china cups and saucers have been broken since his wife’s death, all but one, which is religiously kept for his use. He passes his morning in walking or riding, looking in at auctions, looking after his India bonds or some such money securities, furthering some subscription set on foot by his excellent friend sir John, or cheapening a new old print for his portfolio. He also hears of the newspapers; not caring to see them till after dinner at the coffee-house. He may also cheapen a fish or so; the fishmonger soliciting his doubting eye as he passes, with a profound bow of recognition. He eats a pear before dinner. His dinner at the coffee-house is served up to him at the accustomed hour, in the old accustomed way, and by the accustomed waiter. If William did not bring it, the fish would be sure to be stale, and the flesh new. He eats no tart; or if he ventures on a little, takes cheese with it. You might as soon attempt to persuade him out of his senses, as that cheese is not good for digestion. He takes port; and if he has drank more than usual, and in a more private place, may be induced by some respectful inquiries respecting the old style of music, to sing a song composed by Mr. Oswald or Mr. Lampe, such as— Chloe, by that borrowed kiss, or Come, gentle god of soft repose; or his wife’s favourite ballad, beginning— At Upton on the Hill There lived a happy pair.
  • 83. Of course, no such exploit can take place in the coffee-room; but he will canvass the theory of that matter there with you, or discuss the weather, or the markets, or the theatres, or the merits of “my lord North” or “my lord Rockingham;” for he rarely says simply, lord; it is generally “my lord,” trippingly and genteelly off the tongue. If alone after dinner, his great delight is the newspaper; which he prepares to read by wiping his spectacles, carefully adjusting them on his eyes, and drawing the candle close to him, so as to stand sideways betwixt his ocular aim and the small type. He then holds the paper at arm’s length, and dropping his eyelids half down and his mouth half open, takes cognizance of the day’s information. If he leaves off, it is only when the door is opened by a new comer, or when he suspects somebody is over-anxious to get the paper out of his hand. On these occasions, he gives an important hem! or so; and resumes. In the evening, our Old Gentleman is fond of going to the theatre, or of having a game of cards. If he enjoy the latter at his own house or lodgings, he likes to play with some friends whom he has known for many years; but an elderly stranger may be introduced, if quiet and scientific; and the privilege is extended to younger men of letters; who, if ill players, are good losers. Not that he is a miser; but to win money at cards is like proving his victory by getting the baggage; and to win of a younger man is a substitute for his not being able to beat him at rackets. He breaks up early, whether at home or abroad. At the theatre, he likes a front row in the pit. He comes early, if he can do so without getting into a squeeze, and sits patiently waiting for the drawing up of the curtain, with his hands placidly lying one over the other on the top of his stick. He generously admires some of the best performers, but thinks them far inferior to Garrick, Woodward, and Clive. During splendid scenes, he is anxious that the little boy should see. He has been induced to look in at Vauxhall again, but likes it still less than he did years back, and cannot bear it in comparison with Ranelagh. He thinks every thing looks poor, flaring, and jaded. “Ah!” says he, with a sort of triumphant sigh, “Ranelagh was a noble place! Such taste, such elegance, such beauty! There was the
  • 84. duchess of A. the finest woman in England, sir; and Mrs. L., a mighty fine creature; and lady Susan what’s her name, that had that unfortunate affair with sir Charles. Sir, they came swimming by you like the swans.” The Old Gentleman is very particular in having his slippers ready for him at the fire, when he comes home. He is also extremely choice in his snuff, and delights to get a fresh box-full at Gliddon’s, in King-street, in his way to the theatre. His box is a curiosity from India. He calls favourite young ladies by their Christian names, however slightly acquainted with them; and has a privilege also of saluting all brides, mothers, and indeed every species of lady on the least holiday occasion. If the husband for instance has met with a piece of luck, he instantly moves forward, and gravely kisses the wife on the cheek. The wife then says, “My niece, sir, from the country;” and he kisses the niece. The niece, seeing her cousin biting her lips at the joke, says, “My cousin Harriet, sir;” and he kisses the cousin. He never recollects such weather, except during the great frost, or when he rode down with Jack Skrimshire to Newmarket. He grows young again in his little grand-children, especially the one which he thinks most like himself; which is the handsomest. Yet he likes best perhaps the one most resembling his wife; and will sit with him on his lap, holding his hand in silence, for a quarter of an hour together. He plays most tricks with the former, and makes him sneeze. He asks little boys in general who was the father of Zebedee’s children. If his grandsons are at school, he often goes to see them; and makes them blush by telling the master or the upper-scholars, that they are fine boys, and of a precocious genius. He is much struck when an old acquaintance dies, but adds that he lived too fast; and that poor Bob was a sad dog in his youth; “a very sad dog, sir, mightily set upon a short life and a merry one.” When he gets very old indeed, he will sit for whole evenings, and say little or nothing; but informs you, that there is Mrs. Jones (the housekeeper),—“She’ll talk.”—Indicator.
  • 85. A HAPPY MEETING. And doth not a meeting like this make amends For all the long years I’ve been wand’ring away? To see thus around me my youth’s early friends, As smiling and kind as in that happy day! Though haply o’er some of your brows, as o’er mine, The snow-fall of time may be stealing—what then Like Alps in the sunset, thus lighted by wine, We’ll wear the gay tinge of youth’s roses again. What soften’d remembrances come o’er the heart, In gazing on those we’ve been lost to so long! The sorrows, the joys, of which once they were part Still round them, like visions of yesterday, throng, As letters some hand hath invisibly traced, When held to the flame will steal out on the sight, So many a feeling, that long seem’d effaced, The warmth of a meeting like this brings to light. And thus, as in memory’s bark, we shall glide To visit the scenes of our boyhood anew, Tho’ oft we may see, looking down on the tide, The wreck of full many a hope shining through— Yet still, as in fancy we point to the flowers That once made a garden of all the gay shore, Deceiv’d for a moment, we’ll think them still ours, And breath the fresh air of life’s morning once more So brief our existence, a glimpse, at the most, Is all we can have of the few we hold dear; And oft even joy is unheeded and lost, For want of some heart that could echo it near. Ah! well may we hope, when this short life is gone, To meet in some world of more permanent bliss, For a smile, or a grasp of the hand, hast’ning on, Is all we enjoy of each other in this. But come—the more rare such delights to the heart, The more we should welcome, and bless them the more— They’re ours when we meet—they’re lost when we part, Like birds that bring summer, and fly when ’tis o’er, Thus circling the cup, hand in hand, ere we drink, Let Sympathy pledge us, thro’ pleasure thro’ pain, That fast as a feeling but touches one link, H i h ll d it di t th h th h i
  • 86. Her magic shall send it direct through the chain.
  • 87. Lines to his Cousin ON THE NEW YEAR, By a Westminster Boy. Time rolls away! another year Has rolled off with him; hence ’tis clear His lordship keeps his carriage A single man, no doubt;—and thus Enjoys himself without the fuss And great expense of marriage. His wheel still rolls (and like the river Which Horace mentions) still for ever Volvitur et volvetur. In vain you run against him; place your fleetest filly in the race,— Here’s ten to one he’ll beat her. Of all he sees, he takes a tithe, With that tremendous sweeping scythe, Which he keeps always going; While every step he takes, alas! Too plainly proves that flesh is grass, When he sets out a mowing. And though his hungry ravenous maw Is crammed with food, both dress’d and raw, I’ll wager any betting, His appetite has ever been Just like his scythe, sharp-set and keen, Which never wanted whetting. Could you but see the mighty treat Prepared, when he sits down to eat His breakfast or his dinner,—ah, Not vegetable—flesh,—alone, But timber, houses, iron, stone, He eats the very china. When maidens pray that he will spare Their teeth, complexion, or their hair, Alas! he’ll never hear ’em; Grey locks and wrinkles hourly show, What Ovid told us years ago, Ut Tempus edax rerum!
  • 88. In vain, my dearest girl, you choose (Your face to wash) Olympic dews; In vain you paint or rouge it; He’ll play such havoc with your youth, That ten years hence you’ll say with truth Ah Edward!—Tempus fugit! The glass he carries in his hand Has ruin in each grain of sand; But what I most deplore is, He breaks the links of friendship’s chain, And barters youthful love for gain: Oh, Tempora! oh, Mores! One sole exception you shall find, (Unius generis of its kind,) Wherever fate may steer us; Tho’ wide his universal range, Time has no power the heart to change Of your Amicus Verus. Bath Herald. GERMAN UNIVERSITIES. Germany, which embraces a population of thirty-six millions of people, has twenty-two universities. The following table contains their names according to the order of their foundation, and the number of professors and students: Universities. When founded. Number of Pro- fessors. Number of Students. Prague 1348 55 1449 Vienna 1365 77 1688 Heidelberg 1368 55 626 Warsbourg 1403 31 660 Leipsig 1409 81 1384 Rostock 1419 34 201 Fribourg 1450 35 556
  • 89. Welcome to our website – the perfect destination for book lovers and knowledge seekers. We believe that every book holds a new world, offering opportunities for learning, discovery, and personal growth. That’s why we are dedicated to bringing you a diverse collection of books, ranging from classic literature and specialized publications to self-development guides and children's books. More than just a book-buying platform, we strive to be a bridge connecting you with timeless cultural and intellectual values. With an elegant, user-friendly interface and a smart search system, you can quickly find the books that best suit your interests. Additionally, our special promotions and home delivery services help you save time and fully enjoy the joy of reading. Join us on a journey of knowledge exploration, passion nurturing, and personal growth every day! ebookbell.com