XML has been the biggest buzzword on the Internet community for the past year. But how do you cut through all the hype and actually put it to work? Java revolutionized the programming world by providing a platform-independent programming language. XML takes the revolution a step further with a platform-independent language for interchanging data. Java and XML share many features that are ideal for building web-based enterprise applications, such as platform-independence, extensibility, reusability, and global language (Unicode) support, and both are based on industry standards. Together Java and XML allow enterprises to simplify and lower costs of information sharing and data exchange. Java and XML shows how to put the two together, building real-world applications in which both the code and the data are truly portable.
This book covers:
The basics of XML
Using standard Java APIs to parse XML
Designing new document types using DTDs and Schemas
Writing programs that generate XML data
Transforming XML into different forms using XSL transformations (XSL/T)
Using a web publishing framework like Apache-Cocoon
This is the first book to cover the most recent versions of the DOM specification (DOM 2), the SAX API (SAX 2) and Sun's Java API for XML.
Dear Brent, this is a complete and cool book (and I've already solved some problems with JDOM)...However, regarding your style: who do you think you're writing this book for?
It seems you feel a little bit like a teacher that has to teach an un-interested mob. You justify talking about this and that, and tell me all the time, "poor boy, it's not that bad, maybe we can make it. but even if you don't like it, I'll have to talk about JAXP. however, first I tell you why you need to read about it. and then I tell you what's good about it. and then I'll tell you about XML-RPC, after I've told you why I must tell it to you........"
This style irritates me.
If you write another book please keep this in mind: The reader wants to learn, you don't have to justify talking about JAXP and DOM and all the other things. And the reader is not dumb.
Move to a more straightforward style, away from that nice teacher style.
I have bought and read 5 or 6 O'Reilly books and have come to the conclusion that O'Reilly makes the absolute best non-fluff reference books out there. However, this book makes me wonder. The first 7 chapters are adequately done--then the writer ventures into what other messages describe as "his own pet API" JDOM. My question is "who cares"? I didn't buy this book for something I haven't heard of.
However, I was personally insulted by the STREAM of negative comments that the writer makes towards Microsoft and their products throughout the book. Like it or not, Microsoft is a major player in the world of computing and not every tech-head programmer (aka me) does not worship at the altar of UNIX and platform independence. I do not understand the strategy of a writer making comments like "forced to use Microsoft's parser" in the first chapter of the book and expecting any pro-Microsoft to continue reading. Since I spent $40, I did and had a very hard time finishing it.
I started reading another XML book - Teach Yourself XML in 21 days which put me to sleep, TWICE. Then, after hearing Brett give a talk at a Java Users conference I decided to give this book a try and it was well worth it. I am now recommending this book to friends interested in learning more about Java and XML.
I like the approach of using the Apache (free) software versions of Xerces, Xalan and Cocoon. This allows you to follow along with the code, modify the examples and create your own.
The book gets you started on all of the current APIs: SAX, DOM, and JDOM with sample code that works. If you need an API reference manaul, this books isn't for you.
The author answered an outstanding question long before the Oreilly folks ever got back to me with a response that they couldn't answer my question and would forward the question to the author.
I am sad to say that this is the first O'Reilly book I have come across where I have felt like asking for a refund afterwards.
My biggest objection has to be that the author pads out the middle of the book with his own pet API, JDOM. This is not an "official" API (i.e. no independent implementation), it's not widely used, and it hasn't even made it through peer review. Nevertheless, it takes up a full chapter of the book, and most of the examples following that point are written in... well, guess. Begins with a J.
Following this stance, the book's stance on SAX and DOM seems to be written in part as polemic against their use. After a while, I started grinding my teeth every time I read about the wonders of JDOM.
The book has a tendency to repeat itself at times and feels as though too little editing done. There are parts of the book which are not "about" XML at all, but are about programs which use XML. Apache Xerces and Xalan were welcome additions to the book, but did we really need to read about JSP vs XSP and Cocoon? They actually detract from the book by telling only half the story -- I noticed that although the book talks about XSL to a large extent, the book is not clear on the performance & memory hit of using XSL as opposed to a SAX-like API.
I was looking for a complete, clear reference of SAX and DOM in this book, with examples of how they were used in parsing and possibly an annotated guide to how the specs came together. I didn't get it.
Excellent book in keeping with the O'Reilly tradition. The book has explained the concepts very well, especially if you are new to XML. It has a good connectivity of thoughts through the chapter. It is clear that the author has a very good grasp of what he is writing about, compared to some other. While I'd have enjoyed the marginal verbosity on a lazy Sunday afternoon, the schedule pressures faced by me made it a little less so.
This is an excellent book on Java with XML. It doesn't not teach you everything about XML. One problem I have with the book is that the amount of errors, however, the author respond to my email very quick. One thing I don't like about it is that its flow is slow, very slow. I think I'm so used to the concept of "Pick up a OReilly book and become a good programmer in a week". The author really took his time to explain all the stuff.
It's been a while since I read this book, but I saw this review forum and figured I should share my experience with this book. Overall I am usually impressed with O'Reilly books, but this one was distinctly poor. This book had numerous editing problems (seems like they rushed this one to press) and a weird continuity to it. It just didn't flow nicely at all. But I think my biggest complaint would be that I found way too much info on the simple things that I either already new, or had no trouble understanding (this book was excessively verbose IMHO) and not enough on the topics that are more advanced, and more useful for programers. I don't think we really needed to see a chapter on xml configuration files! One good thing is JDOM, but that doesn't make up for the book''s poor quality. I would have liked to have seen more on newer changing topics, despite the fact they are changing frequently, ones like XPath, XPointer, more on XSLT, and XML Schema. I could go on, but I won't =)
Book reviews: http://sd.znet.com/~dwlarson/bookReviews.html
Java and XML are very important current pieces of technology. Individually, both subjects stand on their own and many books have been written on them. This is the first book I have read where both technologies are combined in a powerful and useful way.
I used the samples from the book on my Macintosh running MRJ 2.2.1 under MacOS 9.0.4. I used the XML Parser for Java and Xalan Processor where I could. The code samples for chapters 1 through 7 are available on my personal site http://sd.znet.com/~dwlarson/xml.html, however I was not able to run the samples after chapter 7 due to MacOS limitations or the inability to obtain the JDOM compiled binaries from O'Reilly.
Chapter 1 introduces, defines, and describes most of the common components of XML: DTD's (Document Type Definitions), XML Schema (Designed to replace and amplify DTD's), PI's (Programming Instructions), Namespaces (Mappings between element prefix and URI), XSL (Extensible Stylesheet Language), XSLT (Extensible Stylesheet Language Transformation), XPath (XML Path Language), XQL (Represent database queries), XSP (Extensible Server Pages).
Further along in Chapter 1, the two models primarily used: SAX (Simple API for XML) and DOM (Document Object Model) are introduced as well as some of the common uses of XML today including some discussion of XML Frameworks.
Chapter 2 uses a base example to explain the parts of an XML file: Header, XML Instructions, Document Type Declarations. It also explains the content in terms of namespaces, elements and attributes. Also what makes XML documents well-formed and valid. Enough detail is provided to understand those concepts. However, I also recommend the XML Pocket Reference (ISBN: I-56592-709-5) be read along in conjunction with this chapter to help solidify the foundation.
Chapter 3 uses the SAX approach and an XML Parser, and takes the reader through in great detail the parsing of the base document. Using the provided Java code, one learns to: instantiate the Reader objects to manage the base document, register the ContentHandler interface, a callback interface used by XML parsers to notify your program of SAX events as they are found in the XML document, use the Document Locator to find elements in the base document, and employ Error Handling techniques.
Chapter 4 continues with SAX and discusses constraining XML through the use of DTD's and Schemas. There are differences in both approaches and sufficient clarity is presented for the reader to see the advantages and disadvantages to both approaches.
Chapter 5 speaks to validation issues with a parser using SAX: turning on Validation, output of XML Validation, and describing the DTDHandler Interface.
Chapter 6 brings out the uses of transforming XML using Xalan and covering: XSL, Formatting Objects, XSL Transformations, XML Path Language (XPath), XSL Templates, Control Structures (Filtering Using XPath, Looping and Iteration, Choosing Elements), User XSL Elements and Attributes, and Copying Data.
Chapter 7 introduces the DOM approach to parsing XML and is the most widely used method for using XML and Java. The weakness of the SAX approach is discussed. I suggest that O'Reilly consider updating source code for this chapter in particular. The errata often does not show clearly where fixes to code need to take place. Complete source code updates should be made to the web site as fixes are made. The DOM explanations cover: DOM and Java, DOM Parsers and Outputs, Nodes and the DOM Tree, modifying a DOM Tree, and memory performance and Gotcha's.
Those first seven chapters form the foundation of the balance of the book's chapters and in their own light thoroughly explain Java and XML.
Chapter 8 expands on the use of O'Reilly's own JDOM library (which really should be distributed in binary format by O'Reilly) which simplifies using XML and Java.
Chapter 9 describes using an XML Frameworks package that runs on Unix and looks very powerful especially the section of Formatting Objects.
Chapter 10 mentions XML-RPC, an approach to send messages between applications instead of using Java's built-in RMI methods. XML-RPC is more lightweight and enables communication between non-Java applications thus overcoming one of the limitations of RMI.
Chapter 11 points out the uses of XML as configuration files, primarily on Unix computers using JDOM, SAX, and DOM.
The last three chapters cover the creation of XML using Java and then how this ties into Business-to-Business real-world applications. Chapter 14 discusses the future of XML Schema and what is to come.
Two Appendices are included to cover the API Reference and the new SAX 2.0 features.
Finally an index is provided to help locate those terms and topics quickly.
I learned a lot from this book and recommend people wanting to understand the two technologies consider purchasing a copy. As I indicated earlier, it would be helpful to readers if O'Reilly would keep the source code updated and provide compiled binaries of their JDOM code.
Rating: 9 out of 10
This rating is my own personal value system and as such is very subjective. I think a rating of 5 means I would read finish reading a book. A rating of 10 would indicate I had trouble putting a book down and have no complaints at all about it.