×

Uh-oh, it looks like your Internet Explorer is out of date.

For a better shopping experience, please upgrade now.

Processing XML with Java': A Guide to SAX, DOM, JDOM, JAXP, and TrAX / Edition 1
     

Processing XML with Java': A Guide to SAX, DOM, JDOM, JAXP, and TrAX / Edition 1

5.0 1
by Elliotte Rusty Harold
 

See All Formats & Editions

ISBN-10: 0201771861

ISBN-13: 2900201771861

Pub. Date: 11/19/2002

Publisher: Addison-Wesley

Written for Java programmers who want to integrate XML into their systems, this practical, comprehensive guide and reference shows how to process XML documents with the Java programming language. It leads experienced Java developers beyond the basics of XML, allowing them to design sophisticated XML applications and parse complicated documents.

Processing

Overview

Written for Java programmers who want to integrate XML into their systems, this practical, comprehensive guide and reference shows how to process XML documents with the Java programming language. It leads experienced Java developers beyond the basics of XML, allowing them to design sophisticated XML applications and parse complicated documents.

Processing XML with Java provides a brief review of XML fundamentals, including XML syntax; DTDs, schemas, and validity; stylesheets; and the XML protocols XML-RPC, SOAP, and RSS. The core of the book comprises in-depth discussions on the key XML APIs Java programmers must use to create and manipulate XML files with Java. These include the Simple API for XML (SAX), the Document Object Model (DOM), and JDOM (a Java native API). In addition the book covers many useful supplements to these core APIs, including XPath, XSLT, the TrAX API, and JAXP.

Practical in focus, Processing XML with Java is filled with over two hundred examples that demonstrate how to accomplish various important tasks related to file formats, data exchange, document transformation, and database integration. You will learn how to read and write XML documents with Java code, convert legacy flat files into XML documents, communicate with network servers that send and receive XML data, and much more. Readers will find detailed coverage of the following:

  • How to choose the right API for the job
  • Reading documents with SAX
  • SAX filters
  • Validation in several schema languages
  • DOM implementations for Java
  • The DOM Traversal Module
  • Output from DOM
  • Reading and writing XML documentswith JDOM
  • Searching XML documents with XPath
  • Combining XSLT transforms with traditional imperative Java code
  • TrAX, the Transformations API for XML
  • JAXP, the Java API for XML Processing

In addition, the book includes a convenient quick reference that summarizes the major elements of all the XML APIs discussed in the book. A related Web site contains the entire book in electronic format, as well as updates and links referenced in the book.

With thorough coverage of the key XML APIs and a practical, task-oriented approach, Processing XML with Java is a valuable resource for all Java programmers who need to work with XML.



Product Details

ISBN-13:
2900201771861
Publisher:
Addison-Wesley
Publication date:
11/19/2002
Edition description:
New Edition
Pages:
1120

Table of Contents

List of Examplesxvii
List of Figuresxxvii
Prefacexxix
Who You Arexxxi
What You Need to Knowxxxii
What You Need to Havexxxii
How to Use This Bookxxxiii
The Online Editionxxxiv
Some Grammatical Notesxxxiv
Contacting the Authorxxxvi
Acknowledgmentsxxxvii
Part IXML1
Chapter 1XML for Data3
Motivating XML3
XML Syntax13
Validity32
Stylesheets43
Summary53
Chapter 2XML Protocols: XML-RPC and SOAP57
XML as a Message Format58
HTTP as a Transport Protocol64
RSS73
Customizing the Request77
XML-RPC82
SOAP96
Custom Protocols118
Summary119
Chapter 3Writing XML with Java121
Fibonacci Numbers122
Writing XML124
Output Streams, Writers, and Encodings132
A Simple XML-RPC Client139
A Simple SOAP Client142
Servlets145
Summary149
Chapter 4Converting Flat Files to XML151
The Budget152
The Model154
Input156
Determining the Output Format159
Building Hierarchical Structures from Flat Data174
Alternatives to Java191
Relational Databases201
Summary208
Chapter 5Reading XML211
InputStreams and Readers211
XML Parsers216
SAX229
DOM234
JAXP238
JDOM242
dom4j246
ElectricXML248
XMLPULL251
Summary254
Part IISAX257
Chapter 6SAX259
What Is SAX?259
Parsing260
Callback Interfaces264
Receiving Documents271
Receiving Elements273
Handling Attributes279
Receiving Characters284
Receiving Processing Instructions288
Receiving Namespace Mappings291
"Ignorable White Space"295
Receiving Skipped Entities296
Receiving Locators298
What the ContentHandler Doesn't Tell You303
Summary304
Chapter 7The XMLReader Interface305
Building Parser Objects305
Input309
Exceptions and Errors315
Features and Properties325
DTDHandler355
Summary365
Chapter 8SAX Filters367
The Filter Architecture367
The XMLFilter Interface370
Content Filters384
The XMLFilterImpl Class407
Parsing Non-XML Documents411
Multihandler Adapters420
Summary428
Part IIIDOM431
Chapter 9The Document Object Model433
The Evolution of DOM434
DOM Modules435
Application-Specific DOMs439
Trees440
DOM Parsers for Java452
Parsing Documents with a DOM Parser455
The Node Interface468
The NodeList Interface482
JAXP Serialization483
DOMException486
Choosing between SAX and DOM489
Summary492
Chapter 10Creating XML Documents with DOM493
DOMImplementation493
Locating a DOMImplementation495
The Document Interface as an Abstract Factory499
The Document Interface as a Node Type513
Normalization534
Summary538
Chapter 11The DOM Core539
The Element Interface539
The NamedNodeMap Interface551
The CharacterData Interface558
The Text Interface563
The CDATASection Interface568
The EntityReference Interface571
The Attr Interface573
The ProcessingInstruction Interface576
The Comment Interface581
The DocumentType Interface584
The Entity Interface586
The Notation Interface590
Summary594
Chapter 12The DOM Traversal Module597
NodeIterator597
NodeFilter605
TreeWalker610
Summary616
Chapter 13Output from DOM617
Xerces Serialization617
OutputFormat619
DOM Level 3627
Summary640
Part IVJDOM641
Chapter 14JDOM643
What Is JDOM?644
Creating XML Elements with JDOM647
Creating XML Documents with JDOM649
Writing XML Documents with JDOM651
Document Type Declarations656
Namespaces659
Reading XML Documents with JDOM664
Navigating JDOM Trees668
Talking to DOM Programs675
Talking to SAX Programs676
Java Integration681
What JDOM Doesn't Do683
Summary684
Chapter 15The JDOM Model687
The Document Class688
The Element Class690
The Attribute Class719
The Text Class724
The CDATA Class729
The ProcessingInstruction Class730
The Comment Class733
Namespaces736
The DocType Class739
The EntityRef Class745
Summary748
Part VXPath/XSLT751
Chapter 16XPath753
Queries754
The XPath Data Model756
Location Paths759
Expressions772
XPath Engines778
DOM Level 3 XPath789
Jaxen799
Summary804
Chapter 17XSLT805
XSL Transformations805
TrAX822
Extending XSLT with Java850
Summary865
Part VIAppendixes867
Appendix AXML API Quick Reference869
SAX869
DOM891
JAXP912
TrAX912
JDOM930
XMLPULL964
Appendix BSOAP 1.1 Schemas969
The SOAP 1.1 Envelope Schema969
The SOAP 1.1 Encoding Schema973
W3C Software Notice and License986
Appendix CRecommended Reading989
Books989
Specifications990
Index993

Customer Reviews

Average Review:

Post to your social network

     

Most Helpful Customer Reviews

See all customer reviews

Processing XML with Java': A Guide to SAX, DOM, JDOM, JAXP, and TrAX 5 out of 5 based on 0 ratings. 1 reviews.
Guest More than 1 year ago
It used to be that to get a job as a java programmer, all you typically needed was knowledge of java itself plus some general background in computer science. But today we have a severe high tech slump, and technology has also moved on. The former has caused companies that are still hiring, and those that are picking programmers to retain, to require a broader skill set. One of these has been produced by the latter, XML. It really is shaping up that data serialisation is increasingly in XML format, if that data exists outside a database. So for professional reasons you should learn XML, if you are indeed any type of programmer. For example, Microsoft's .NET revolves around XML, and they don't use java. But it turns out that the coupling between java and XML is tight. The most advanced parsers for XML exist for java. In C++ and C#, the parsers are essentially one step/generation behind. Given this, where do you turn to learn XML? An excellent choice is this book. A voluminous and eloquent exposition of the uses of XML. Harold covers the latest versions of the SAX and DOM parsers, explaining the relative merits. As a java programmer, you should find the idea behind SAX simple. It uses a callback, similar to that in GUIs. Simpler, in fact, because you can only have a single callback. SAX's biggest drawback is that it does not build a tree of the document. DOM addresses this. Harold explains the tradeoffs, and how you can decide which to use. Plus, he describes JDOM, which is DOM-like, but written expressly for java. You should find JDOM far more intuitive than DOM. There is one place where I must differ with the author. He claims that this book is for the experienced java programmer who has already had some XML. I think he is being too conservative; he doesn't want to oversell this book to someone who will not benefit from it. I claim that if you are experienced, by which I mean you have a year or more in java, then you have the intellectual wherewithal to gain, even if you have never seen a stitch of XML.