Apr 17, 2008

XML - Application Programming Interfaces (APIs)

Overview Java XML API

The most important decision you'll make at the start of an XML project is the application- programming interface (API) you'll use. Many APIs are implemented by multiple vendors, so if the specific parser gives you trouble you can swap in an alternative, often without even recompiling your code. However, if you choose the wrong API, changing to a different one may well involve redesigning and rebuilding the entire application from scratch. Of course, as Fred Brooks taught us, “In most projects, the first system built is barely usable. It may be too slow, too big, awkward to use, or all three. There is no alternative but to start again, smarting but smarter, and build a redesigned version in which these problems are solved.… Hence plan to throw one away; you will, anyhow. ” [1] Still, it is much easier to change parsers than APIs.

There are two major standard APIs for processing XML documents with Java, the Simple API for XML (SAX) and the Document Object Model (DOM), each of which comes in several versions. In addition there are a host of other, somewhat idiosyncratic APIs including JDOM, dom4j, ElectricXML, and XMLPULL. Finally each specific parser generally has a native API that it exposes below the level of the standard APIs. For instance, the Xerces parser has the Xerces Native Interface (XNI). However, picking such an API limits your choice of parser, and indeed may even tie you to one particular version of the parser since parser vendors tend not to worry a great deal about maintaining native compatibility between releases. Each of these APIs has its own strengths and weaknesses.

SAX
SAX, the Simple API for XML, is the gold standard of XML APIs. It is the most complete and correct by far. Given a fully validating parser that supports all its optional features, there is very little you can’t do with it. It has one or two holes, but they're really off in the weeds of the XML specifications, and you have to look pretty hard to find them. SAX is a event driven API. The SAX classes and interfaces model the parser, the stream from which the document is read, and the client application receiving data from the parser. However, no class models the XML document itself. Instead the parser feeds content to the client application through a callback interface, much like the ones used in Swing and the AWT.
This makes SAX very fast and very memory efficient (since it doesn’t have to store the entire document in memory). However, SAX programs can be harder to design and code because you normally need to develop your own data structures to hold the content from the document. SAX works best when your processing is fairly local; that is, when all the information you need to use is close together in the document. For example, you might process one element at a time. Applications that require access to the entire document at once in order to take useful action would be better served by one of the tree-based APIs like DOM or JDOM. Finally, because SAX is so efficient, it’s the only real choice for truly huge XML documents. Of course, “truly huge” has to be defined relative to available memory. However, if the documents you're processing are in the gigabyte range, you really have no choice but to use SAX.

DOM
DOM, the Document Object Model, is a fairly complex API that models an XML document as a tree. Unlike SAX, DOM is a read-write API. It can both parse existing XML documents and create new ones. Each XML document is represented as Document object. Documents are searched, queried, and updated by invoking methods on this Document object and the objects it contains. This makes DOM much more convenient when random access to widely separated parts of the original document is required. However, it is quite memory intensive compared to SAX, and not nearly as well suited to streaming applications.

JAXP
JAXP, the Java API for XML Processing, bundles SAX and DOM together along with some factory classes and the TrAX XSLT API. (TrAX is not a general purpose XML API like SAX and DOM. I'll get to it in Chapter 17.) It is a standard part of Java 1.4 and later. However, it is not really a different API. When starting a new program, you ask yourself whether you should choose SAX or DOM. You don’t ask yourself whether you should use SAX or JAXP, or DOM or JAXP. SAX and DOM are part of JAXP.

JDOM
JDOM is a Java-native tree-based API that attempts to remove a lot of DOM’s ugliness. The JDOM mission statement is, “There is no compelling reason for a Java API to manipulate XML to be complex, tricky, unintuitive, or a pain in the neck,” and for the most part JDOM delivers. Like DOM, JDOM reads the entire document into memory before it begins to work on it; and the broad outline of JDOM programs tends to be the same as for DOM programs. However, the low-level code is a lot less tricky and ugly than the DOM equivalent. JDOM uses concrete classes and constructors rather than interfaces and factory methods. It uses standard Java coding conventions, methods, and classes throughout. JDOM programs often flow a lot more naturally than the equivalent DOM program. I think JDOM often does make the easy problems easier; but in my experience JDOM also makes the hard problems harder. Its design shows a very solid understanding of Java, but the XML side of the equation feels much rougher. It’s missing some crucial pieces like a common node interface or superclass for navigation. JDOM works well (and much better than DOM) on fairly simple documents with no recursion, limited mixed content, and a well-known vocabulary. It begins to show some weakness when asked to process arbitrary XML. When I need to write programs that operate on any XML document, I tend to find DOM simpler despite its ugliness.

Download XML - Application Programming Interfaces (APIs)

Windows Vista for Starters: The Missing Manual

Table of Content Windows Vista for Starters: The Missing Manual

Chapter 1: Welcome Center, Desktop, and the Start Menu Chapter 2: Explorer, Windows, and the Taskbar Chapter 3: Searching and Organizing Your Files
Chapter 4: Interior Decorating Vista Chapter 5: Getting Help Chapter 6: Programs, Documents, and Gadgets
Chapter 7: The Freebie Software Chapter 8: The Control Panel Chapter 9: Hooking Up to the Internet
Chapter 10: Internet Security Chapter 11: Internet Explorer 7 Chapter 12: Windows Mail
Chapter 13: Windows Photo Gallery Chapter 14: Windows Media Player Chapter 15: Movie Maker and DVD Maker
Chapter 16: Media Center Chapter 17: Fax, Print, and Scan Chapter 18: Hardware
Chapter 19: Laptops, Tablets, and Palmtops Chapter 20: Maintenance and Speed Tweaks Chapter 21: The Disk Chapter
Chapter 22: Backups and Troubleshooting Chapter 23: Accounts (and Logging On) Chapter 24: Setting Up a Workgroup Network
Chapter 25: Network Domains Chapter 26: Network Sharing and Collaboration Chapter 27: Vista by Remote Control


Fast-paced and easy to use, this concise book teaches you the basics of Windows Vista so you can start using this operating system right away. Written by "New York Times" columnist, bestselling author, Emmy-winning CBS News correspondent and Missing Manuals creator David Pogue, the book will help you:
  • Navigate the desktop, including the fast, powerful and fully integrated desktop search function
  • Use the Media Center to record TV and radio, present photos, play music, and record all of these to a DVD
  • Breeze across the Web with the vastly improved Internet Explorer 7 tabbed browser
  • Become familiar with Vista's beefed up security, and much more

Windows Vista is a vast improvement over its predecessors, with an appealing, glass-like visual overhaul, superior searching and organization tools, a multimedia and collaboration suite, and a massive, top-to-bottom security-shield reconstruction. Every corner of the traditional Windows operating system has been tweaked, overhauled, or replaced entirely.

Aimed at new and experienced computer users alike, Windows Vista for Starters: The Missing Manual is right there when you need it. This jargon-free book explains Vista's features quickly and clearly -- revealing which work well and which don't.

Download Windows Vista for Starters: The Missing Manual

Apr 15, 2008

java xml soap: Processing XML with Java


Processing XML with Java™: A Guide to SAX, DOM Java, JDOM, JAXP, and TrAX, java xml database. This book and tutorial is written for experienced Java developers who want to integrate XML into their systems. Java is the ideal language for processing XML documents. Its strong Unicode support in particular made it the preferred language for many early implementers. Consequently, more XML tools have been written in Java than in any other language. More open source XML tools are written in Java than in any other language. More developers process XML in Java than in any other language.

Processing XML with Java™ will teach you how to
Save XML documents from applications written in Java
Read XML documents produced by other programs
Search, query, and update XML documents
Convert legacy flat data into hierarchical XML
Communicate with network servers that send and receive XML data
Validate documents against DTDs, schemas, and business rules
Combine functional XSLT transforms with traditional imperative Java code


Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX is intended for Java developers who need to do anything with XML. It teaches the fundamentals and advanced topics, leaving nothing out. It is a comprehensive course in processing XML with Java that takes developers from having little knowledge of XML to designing sophisticated XML applications and parsing complicated documents. The examples cover a wide range of possible uses, including file formats, data exchange, document transformation, database integration, and more.

Praise for Elliotte Rusty Harold's Processing XML for Java™
List of Examples
List of Figures
Preface
Who You Are
How to Use This Book
The Online Edition
Some Grammatical Notes
Contacting the Author
Acknowledgments

Part I. XML
Chapter 1. XML for Data
Motivating XML
XML Syntax
Validity
Stylesheets
Summary

Chapter 2. XML Protocols: XML-RPC and SOAP
XML as a Message Format
HTTP as a Transport Protocol
RSS
Customizing the Request
XML-RPC SOAP
Custom Protocols
Summary

Chapter 3. Writing XML with Java
Fibonacci Numbers
Writing XML
Output Streams, Writers, and Encodings
A Simple XML-RPC Client
A Simple SOAP Client
Servlets
Summary

Chapter 4. Converting Flat Files to XML
The Budget
The Model
Input
Determining the Output Format
Building Hierarchical Structures from Flat Data
Alternatives to Java
Relational Databases
Summary

Chapter 5. Reading XML
InputStreams and Readers
XML Parsers
SAX
DOM
JAXP
JDOM
dom4j
ElectricXML
XMLPULL
Summary


Part II. SAX
Chapter 6. SAX
What Is SAX?
Parsing
Callback Interfaces
Receiving Documents
Receiving Elements
Handling Attributes
Receiving Characters
Receiving Processing Instructions
Receiving Namespace Mappings
"Ignorable White Space"
Receiving Skipped Entities
Receiving Locators
What the ContentHandler Doesn't Tell You
Summary

Chapter 7. The XMLReader Interface
Building Parser Objects
Input
Exceptions and Errors
Features and Properties
DTDHandler
Summary

Chapter 8. SAX Filters
The Filter Architecture
The XMLFilter Interface
Content Filters
The XMLFilterImpl Class
Parsing Non-XML Documents
Multihandler Adapters
Summary


Part III. DOM
Chapter 9. The Document Object Model
The Evolution of DOM
DOM Modules
Application-Specific DOMs
Trees
DOM Parsers for Java
Parsing Documents with a DOM Parser
The Node Interface
The NodeList Interface
JAXP Serialization
DOMException
Choosing between SAX and DOM
Summary

Chapter 10. Creating XML Documents with DOM
DOMImplementation
Locating a DOMImplementation
The Document Interface as an Abstract Factory
The Document Interface as a Node Type
Normalization
Summary

Chapter 11. The DOM Core
The Element Interface
The NamedNodeMap Interface
The CharacterData Interface
The Text Interface
The CDATASection Interface
The EntityReference Interface
The Attr Interface
The ProcessingInstruction Interface
The Comment Interface
The DocumentType Interface
The Entity Interface
The Notation Interface
Summary

Chapter 12. The DOM Traversal Module
NodeIterator
NodeFilter
TreeWalker
Summary

Chapter 13. Output from DOM
Xerces Serialization
OutputFormat
DOM Level 3
Summary


Part IV. JDOM
Chapter 14. JDOM
What Is JDOM?
Creating XML Elements with JDOM
Creating XML Documents with JDOM
Writing XML Documents with JDOM
Document Type Declarations
Namespaces
Reading XML Documents with JDOM
Navigating JDOM Trees
Talking to DOM Programs
Talking to SAX Programs
Java Integration
What JDOM Doesn't Do
Summary

Chapter 15. The JDOM Model
The Document Class
The Element Class
The Attribute Class
The Text Class
The CDATA Class
The ProcessingInstruction Class
The Comment Class
Namespaces
The DocType Class
The EntityRef Class
Summary


Part V. XPath/XSLT
Chapter 16. XPath
Queries
The XPath Data Model
Location Paths
Expressions
XPath Engines
DOM Level 3 XPath
Jaxen
Summary

Chapter 17. XSLT
XSL Transformations
TrAX
Extending XSLT with Java
Summary


Part VI. Appendixes
Appendix A. XML API Quick Reference
SAX
DOM
JAXP
TrAX
JDOM
XMLPULL

Appendix B. SOAP 1.1 Schemas
The SOAP 1.1 Envelope Schema
The SOAP 1.1 Encoding Schema
W3C Software Notice and License

Appendix C. Recommended Reading
Books
Specifications

Download java xml soap: Processing XML with Java
Publisher : Addison Wesley
Pub Date : November 08, 2002
ISBN : 0-201-77186-1
Pages : 1120

Apr 9, 2008

Java XML APIs for XML Kick Start

Introduction Java XML Api Tutorial for XML Kick Start Is Organized?

Each of this book's parts are described using simple and easy-to-follow sample applications.

The first part covers the basics you'll need to learn before you can start using JAX. These include understanding the constituent components of the Web service architecture: SOAP, UDDI, and WSDL. Also covered in this part is an overview of the specific APIs.

The second part describes the Java APIs for XML Processing (JAXP), covering the SAX, DOM, and XSLT specifications. The XML processing specifications enable an application to parse an XML document in different ways.

The third part describes the Java APIs for XML Messaging (JAXM). These APIs make it possible for applications to programmatically create and send SOAP messages.

The fourth part covers the Java APIs for XML Registries (JAXR) and Remote Procedure Calls (JAX-RPC). These APIs provide the necessary mechanism for applications to connect to UDDI-based registries and submit, manage, and query data. JAX-RPC enables applications to perform remote procedure calls over the Internet.

The fifth part describes a case study that shows how the components of JAX work together to create a successful Web service. This part also has brief descriptions of the Java Architecture for XML Binding (JAXB) and upcoming APIs that will provide even more flexibility in developing XML-based applications using Java.

Finally, there are two appendixes: The first appendix describes how to download and install JAX, and the second provides a quick overview of XML.


Introduction
How This Book Is Organized
Source Code and Updates

Part I. JAX Basics
Chapter 1. Using XML for Electronic Data Interchange
XML and EDI
Java and XML
Summary

Chapter 2. Components of Web Services
Web Services
SOAP
UDDI
WSDL
JAX and Web Services: The Great Car Parts Company Scenario
Summary


Part II. JAXP: Java API for XML Processing
Chapter 3. Implementing Simple APIs for XML
The Packages in JAXP for Using SAX
The Key JAXP Classes and Interfaces for SAX Support
The JAXP and Reference Implementation JAR Files
Creating a SAX-Parsing Application
Summary

Chapter 4. Advanced Use of SAX
Identifying Document and Event Locations
Handling Lexical Events
Customizing External Entity Resolution
Handling Namespaces
Generating SAX Events from a Text File
Summary

Chapter 5. The Document Object Model
Overview
The DOM and the JAXP Packages
Creating a DOM Application
Accessing XML Data Using DOM
Managing Data Using DOM
Summary

Chapter 6. XSLT and XPath
Overview
The XSLT Packages
Using XSLT with DOM
Using XSLT with SAX
SAX or DOM?
XPath
Transforming XML
Creating the MyXSLTTransformer Application
Summary


Part III. JAXM: Java API for XML Messaging
Chapter 7. Messaging Fundamentals
JAXM Message Exchange Categories
Interoperability with Other Messaging Applications
JAXM and SOAP Messaging Styles
JAXM Elements
The JAXM Packages
Summary

Chapter 8. Creating Client Implementations
Standalone Client Implementation
Client with Messaging Provider
Summary


Part IV. JAXR and JAX-RPC
Chapter 9. Registry Fundamentals
Existing Registries
Registry Uses
Registry Use Model
The Registry Information Model
The JAXR Specification
The JAXR Architecture
The JAXR Packages
Summary

Chapter 10. JAXR Implementations
The JWSDP Registry Server
Publishing Data to a Registry
Querying Data from a Registry
Deleting Data from Registry
Summary

Chapter 11. Working with JAX-RPC
JAX-RPC Working Mechanism
Constituents of a JAX-RPC Server and Client
JAX-RPC Packages
The javax.xml.rpc Package
The xrpcc Tool
The Types Supported by JAX-RPC
The CarPartRequest Web Service
The CarPartRequestClient Application
Summary


Part V. JAX in the Real World and the Future
Chapter 12. Case Study: Deploying a Web Service Using JAX
Case Study Description
Order of Development
Setting Up the JWSDP Registry Server
Creating Applications That Register Supplier Information to the Registry
Developing the Web Services
Summary

Chapter 13. Looking Ahead: JAXB and Beyond
Java Architecture for XML Binding
JAXB Components
JDOM 1.0
XML Trust Service APIs
XML Digital Signature APIs
XML Digital Encryption APIs
XML Transactioning API for Java (JAXTX)
ebXML CPP/A APIs for Java
Streaming API for XML (StAX)
Java APIs for WSDL
Summary


Part VI. Appendixes
Appendix A. Installing the JAX Pack
Java XML Pack
Java Web Services Developer Pack (JWSDP)
JAX XML Pack or JWSDP?
Getting and Installing JWSDP

Appendix B. XML: A Quick Tour
What Is XML?
A Sample XML Document
The XML Declaration
Comments
The Root Element
Processing Instructions
Elements
Attributes
Character References
Entity References
CDATA Section
Document Type Definition (DTD)
The Document Type Declaration
Declaring Elements
Declaring Attributes

Download This Books

J2EE Best Practices: Java Design Patterns, Automation, and Performance


Overview of the Book and Technology
J2EE Best Practices: Java Design Patterns, Automation, and Performance will supply a set of best practices for J2EE software development and then use them to construct an application architecture approach referred to as the reference architecture. The reference architecture will provide a basis for rapidly building transactional business applications using J2EE technology. The design and implementation of the reference architecture is based on a set of guiding principles that will be used to optimize and automate J2EE development.

Contents :
Chapter 1 Building Business Applications with J2EE
Elements of Transactional, Web-Based Business Applications, The Reference Architecture, The J2EE Platform Approach, The Model-View-Controller Architecture Approach, Best Practices for Building Business Applications
with J2EE

Chapter 2 The Business Object Architecture: Design Considerations
Business Objects in a Banking Application, Elements of Business Objects, Design Considerations, Best Practices for Designing Business Objects


Chapter 3 Building Business Objects: Managing Properties and Handling Errors
Managing Properties, Value Objects and Lightweight Business Objects, Object Validation and Error Handling, Best Practices for Implementing Business Objects: Part One


Chapter 4 Building Business Objects: Persistence, Relationships, and the Template Method Pattern
Object Persistence, The Base Class as a Template, Overall Business Object Metadata Approach, Data Caching, Best Practices for Implementing Business Objects: Part Two

Chapter 5 The Service-Based Architecture: Design Considerations
Elements of Service-Based Components, Design Considerations, Best Practices for Designing Service-Based Components

Chapter 6 Building Service-Based Components
The Actual Service Interface, An Implementation for Argument Lists, The Session Bean as a Component Wrapper to the Service, Responsibilities of the Service Component,
Update Service Examples 225
Updating Multiple Business Objects 233
The New Customer Service 234
Data Retrieval Services 240
Building Generic, Reusable Services 251
Implementing the Controller Pattern in Services 253
Best Practices for Implementing Service-Based
Components

Chapter 7 The User Interaction Architecture: Design Considerations and an Overview of Jakarta Struts
Elements of the User Interaction Architecture 261
Design Considerations 265
An Overview of Jakarta Struts 284
Best Practices for Designing the User
Interaction Architecture


Chapter 8 Building the User Interaction Architecture
The Change Address Page 301
The Change Address JSP 307
The View Accounts Page 332
The New Customer Wizard 342
A Template for the Action Class 362
Web Services 369
Best Practices for Implementing the
User Interaction Architecture

Chapter 9 Strengthening the Bank Application: Adding Security and Advanced Functionality
Application Security 375
Interesting Aspects of the Bank Application 392
Best Practices for Advanced Web Application Development 417

Chapter 10 Performance
Overall Performance Approach 421
Performance in J2EE Applications 430
Best Practices for J2EE Performance Engineering

Chapter 11 Moving toward Reuse in the Reference Architecture
Common Roadblocks and Corresponding Best Practices 444
Reuse in the Reference Architecture 452
The Strategic View of the Architecture 454
Best Practices for Moving toward Reuse


Download This Books
Page 496
Copyright © 2003 by Darren Broemmer. All rights reserved.
Published by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
Publisher: Bob Ipsen
Editor: Theresa Hudson
Developmental Editor: Kenyon Brown
Editorial Manager: Kathryn A. Malm
Managing Editor: Pamela Hanley
New Media Editor: Brian Snapp
Text Design & Composition: Interactive Composition Corporation