Introduction
Berkeley DB XML is exciting to me for multiple reasons. Text data is appealing (as you’ll realize
as you read The Definitive Guide to Berkeley DB XML), and I crave technologies that make it easy
to work with. XML is attractive for its flexibility, XPath for its intuitive elegance, XSLT for its declar-
ative nature, and so on. I know full well that XML didn’t break new technical ground or invent
something we didn’t already have. I don’t care about that. What XML did was to convince an indus-
try to use it—and to use it everywhere. Call it hype; call it The Man. The bottom line is that I now
have an astonishing array of tools and technologies, all compatible, to work with data as I like.
Until recently, a database was the big missing link; I had to convert data to and from SQL to
index it. Eventually, XML databases began to pop up. But even as they did, I was unhappy with
their design: most were language-specific, some were just XML-to-RDB interfaces, many had pro-
prietary or otherwise limited query languages, and so on.
Berkeley DB XML caught my eye for three reasons. First, it’s Sleepycat, and I’ve been a big
fan of Berkeley DB for a long time—its ease of use, its simplicity, and its near-ubiquity. Second,
it’s embedded, which is one of my pet requirements on any project that doesn’t absolutely need a
database server (just ask my associates). And third, it has language API support for all the major
programming languages. When version 2 came along with full support for the industry-standard
XQuery language (which is so cool), it was ready for production use in my own sizable projects.
I doubt that many technical books get written if the author isn’t excited by the subject matter.
I want to assure you that this is the case for The Definitive Guide to Berkeley DB XML. I wanted this
book to exist because BDB XML has made so much of my current work feasible and fun. I think it’s
an important piece of software that can dramatically improve how you work with data: how you
store it, how you search it, and how you retrieve it. I think XQuery is a great domain-specific lan-
guage that makes querying data…er, enjoyable, if I dare say so.
That’s what I think. And so I wrote the book I wanted to read on the matter.
Who This Book Is For
The Definitive Guide to Berkeley DB XML is for any developer who works with XML, whatever the
application. I included an XML overview (Appendix A “XML Essentials”) for developers who aren’t
necessarily familiar with XML. The early chapters address programmers who might be unconvinced
of the benefits of either an embedded database or the benefits of XML itself, but there’s also plenty
of information there for any converts.
As long as I brought it up, rest assured that I’m not a total zealot. I think that most applica-
tion technologies—programming languages, markup languages, databases, data transports, query
languages—have their time and place. No one tool is good for everything—some are great at some
things, and all are horrible at least one thing. BDB XML is no different. I would never suggest that
it should completely replace other data solutions, for example. That said, it has replaced many
(but not all) of my own such systems, particularly in the area of document storage, and I am quite
happy with the results.
The Definitive Guide to Berkeley DB XML is not an exhaustive treatment of XQuery, XML, or
related technologies. This book instead pulls them together as used by Berkeley DB XML and gives
you everything you need to know about them to work with it.
xix
6668fm.qxd 7/20/06 3:38 PM Page xix