Procesing XML with Java book cover

Processing XML with Java

Elliotte Rusty Harold

Welcome to Processing XML with Java, a complete tutorial about writing Java programs that read and write XML documents. This is the most comprehensive and up-to-date book about integrating XML with Java (and vice versa) you can buy. It contains over 1000 pages of detailed information on SAX, DOM, JDOM, JAXP, TrAX, XPath, XSLT, SOAP, and lots of other juicy acronyms. This book is written for Java programmers who want to learn how to read and write XML documents from their code. The paper version is published by Addison-Wesley, and can be found at fine bookstores everywhere including Amazon and Barnes & Noble. The list price is $54.95, but most bookstores are offering their usual discounts.

Normally, this is the point where I'd spend a few paragraphs describing just what's in the book and how important it is to your education, your career, and your love life; but this time I've done something a little different. The entire book is available online. You can read every chapter and every page so you can see for yourself how well this book answers your questions such as, "Why does SAX truncate the text in my documents after a few thousand characters?" "How do I serialize a DOM Document object in an implementation-independent way?" or, "Why doesn't my significant other understand the importance of a building a life size Millennium Falcon in our backyard?" Consequently, I'll forego the usual hype. Check the book out for yourself. The entire book is here at Cafe con Leche. You can read every word of it, all seventeen chapters and two appendixes. If you like it, please buy a copy. I promise it's cheaper than printing all 1100+ pages on your laser printer.


I've extracted out all the examples into individual files. You can download them as a zip archive if you like.

Contacting the Author

Your commentary and feedback is much desired, both on major issues (e.g. "Why don't you cover JAXB?") and minor ones ("Cat is misspelled in the first sentence of page 42.") Please send all feedback directly to me at


This is not an introductory book. It assumes that you're completely familiar with Java including objects, classes, polymorphism, I/O, network programming, and more. It also assumes that you're familiar with XML at about the level of the XML Bible, 2nd Edition. In many ways this book picks up where that one left off.

Copying these Files

I'd like to ask that you not mirror these files on your own servers. It's difficult to keep multiple, unoffical mirrors in sync, and I don't want to deal with questions based on out of date copies. This site is hosted on the very fast, very well-connected IBiblio servers near the Internet backbone and should have enough bandwidth for everyone. If you want to save a copy on your local hard drive for your own use, feel free, However, please don't pass out copies of your own copies to anyone else. Instead refer your friends and colleagues to this web site.


This entire book was written in XML from start to finish. The specific XML application used is DocBook 4.2.0. I use the jEdit text editor on Windows and Linux to write. XInclude is used to merge the individual chapters and examples together. Michael Kay's SAXON XSLT processor and Norm Walsh's XSL stylesheets for Docbook 1.52.2 produce the HTML and XSL-FO output. I use FOP 0.20.4 to convert the XSL-FO files to PDFs. The DocBook source files were pulled into Adobe FrameMaker to layout the printed book.

Copyright 2001-2003 Elliotte Rusty Harold
Last Modified April 17, 2003