View Review Details


Book:   Java and XML
Subject:   Java and XML Review
Date:   2000-11-19 14:44:28
From:   Donald W. Larson
Rating:  StarStarStarStarStar

Java and XML


Paperback, First printing, 465 pages


By Brett McLaughlin


Published by O'Reilly & Associates, Inc.


Copyright © June 2000


ISBN: 0-596-00016-2


Review written: November 19, 2000


By Donald W. Larson


Email: dwlarson@sd.znet.com


Web Site: http://www.sandiegodon.com/


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.


See larger cover