Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Aug 14, 2008

Pro PHP XML and Web Services (Pro)

Pro PHP XML and Web Services is the authoritative guide to using the XML features of PHP 5 and PHP 6. No other book covers XML and Web Services in PHP as deeply as this title. The first four chapters introduce the core concepts of XML required for proficiency, and will bring you up to speed on the terminology and key concepts you need to proceed with the rest of the book. Next, the book explores utilizing XML and Web Services with PHP5. Topics include DOM, SimpleXML, SAX, xmlReader, XSLT, RDF, RSS, WDDX, XML-RPC, REST, SOAP, and UDDI.

Author Robert Richards, a major contributor to the PHP XML codebase, is a leading expert in the PHP community. In this book, Richards covers all topics in depth, blending theory with practical examples. Youll find case studies for the most popular web services like Amazon, Google, eBay, and Yahoo. The book also covers XML capabilities, demonstrated through informative examples, in the PEAR libraries.


About the Author
Robert Richards, currently an independent contractor, has worked in various fields including Medical Information, Telecommunications, Media and E-Learning. Having been exposed to XML since its inception and used for various projects during his career, his most extensive work with the technology was within the E-Learning space. He helped created a proprietary XML based application server which used XML for data publishing, defining application business logic as well as data querying. He was also the lead engineer for the company's involvement in SCORM (Shareable Content Object Reference Model), used for Web based learning, established by the Department of Defense through its Advanced Distributed Learning (ADL) initiative.

After becoming the latest casualty of the "dot-com" implosion in 2001, Rob had his first taste of PHP and began contributing code to the domxml extension in 2002. Since then he became one of the authors of the DOM extension for PHP 5, contributes to the other XML based extensions and has authored the xmlReader, for PHP 5, and xmlwriter, for PHP 4.3+, extensions. Also on occasion, he contributes bug fixes to the libxml2 project found during the development of these extensions.


Download:
http://rapidshare.de/files/31391202/b-042b01.rar
http://www.mytempdir.com/899095

May 2, 2008

Processing XML with Java


This XML with Java ebooks tutorial™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX 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.

Content this ebooks :
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

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


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

Chapter 17. XSLT
XSL Transformations
TrAX
Extending XSLT with Java

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


Download This Books......

Apr 30, 2008

Pro PHP XML and Web Services


How This Book Is Structured

For you to get the most out of XML and Web services in PHP, this book is really grouped into three sections. The first section contains terminology and technical information about XML. This includes the concepts and structure of an XML document, validation, and other XML technologies commonly used. The chapters covering this information are based on various specifications. These specifications often use cryptic language and are difficult to understand, so I distill the information in clear terms.

The next group of chapters covers how to parse and manipulate XML documents using some of the extensions in PHP. I explain each extension and its API in detail with real-world examples to help reenforce the concepts covered. I also compare and contrast the extensions, providing you with some insight about where a particular extension excels and how it may not be the correct one to use in a particular situation.

The last group of chapters covers Web services. Although only a single native Web service extension exists in PHP (SOAP), I will provide in-depth coverage of additional technologies using
the extensions from earlier chapters. In addition, I will cover how to integrate with the Yahoo, Google, Amazon, and eBay Web services. Specifically, the chapters break down as follows:

Chapter 1, “Introduction to XML and Web Services”: This chapter provides some background information about XML and Web services. In addition, the chapter defines what these terms mean, explains the history of how they came about, and shows some examples of how XML is used in the real world.

Chapter 2, “XML Structure”: The XML 1.0 specification defines what XML is and the structure of documents but uses language that is not always so straightforward. This chapter explains the structure of an XML document in simple terms and provides some lucid examples. In addition, this chapter introduces some terminology used throughout the book.

Chapter 3, “Validation”: This chapter explains the use of validation in XML using Document Type Definitions (DTDs), XML Schemas, and RELAX NG.

Chapter 4, “XPath, XPointer, XInclude, and the Future”: The focus of this chapter is explaining how to write XPath expressions to query an XML document. You can use XPath with a few of the PHP extensions, and XPath serves as the foundation for XSLT in Chapter 10. The chapter also explains both XPointer and XInclude, which allow for more advanced XML processing.

Chapter 5, “PHP and XML”: This chapter introduces the new XML support in PHP 5.
It explains much of the functionality shared by the XML-based extensions, such as parser options, error handling, PHP streams, and document encoding.

Chapter 6,“Document Object Model (DOM)”: This chapter provides an in-depth look at using the DOM extension and shows how it is used to manipulate an XML document.

Chapter 7, “SimpleXML”: The SimpleXML extension provides a simple interface for working with XML documents. This chapter explains how to use the extension to access virtually any type of XML document, including more complex ones that use namespaces.

Chapter 8, “Simple API for XML (SAX)”: This chapter explains how to work with the xml extension and covers issues you may encounter when migrating an application that uses this extension from PHP 4 to PHP 5.

Chapter 9, “XMLReader”: The XMLReader extension is a lightweight parser and an alternative to the xml extension covered in Chapter 8. This chapter explains and demonstrates how to process an XML document using this extension.

Chapter 10, “Extensible Stylesheet Language Transformation (XSLT)”: You can transform XML documents using XSLT. This chapter begins by explaining the XSLT specification in easy-to-understand terms. Then, this chapter shows how to use the XSL extension in PHP to perform transformations.

Chapter 11, “Effective and Efficient Processing”: With a number of different extensions that can be used to work with XML in PHP, it is often difficult to decide which one to use. This chapter explains the differences between the extensions and continues with tips and tricks that can be used to optimally work with XML in PHP.

Chapter 12, “XML Security”: Data integrity and data security are topics that every developer must be concerned with when writing applications. In this chapter, you will learn how to work with digital signatures and encryption as they pertain to XML.

Chapter 13, “PEAR and XML”: The PHP Extension and Application Repository (PEAR) is a collection of software that can be used when writing an application. This chapter introduces PEAR and explores some of the XML packages it provides.

Chapter 14, “Content Syndication: RSS and Atom”: Content syndication has become popular with the explosion of weblogs (blogs). This chapter examines the three formats that are used to syndicate data and shows how to create and consume syndicated feeds using the PHP extensions.

Chapter 15, “Web Distributed Data Exchange (WDDX)”: This chapter explains what WDDX is and how you can use the wddx extension to exchange data between systems.

Chapter 16, “XML-RPC”: This chapter examines the structure and exchange of XML-RPC documents. You will then learn about the xmlrpc extension and how you can use it to communicate with remote systems.

Chapter 17, “Representational State Transfer (REST)”: Representational State Transfer (REST) is a simple method to create and consume Web services. I demonstrate how to create and consume REST-based services. In particular, you will see how to consume some real services from both Yahoo and Amazon.

Chapter 18, “SOAP”: SOAP allows for the creation of complex Web services. The specifications involved are also quite complex. In this chapter, I show examples of both the Web Services Description Language (WSDL) specification and the SOAP specification. Using this knowledge, you will see how to use the SOAP extension in PHP using realworld examples from eBay and Google.

Chapter 19,“Universal Description,Discovery, and Integration (UDDI)”: UDDI is a technology meant to make working with Web services easier. This chapter shows how you can use PHP to access and maintain records in a UDDI registry.

Chapter 20, “PEAR and Web Services”: Chapter 13 introduces PEAR and its XML packages;this chapter introduces you to some packages that you can use to create and consume a variety of Web services.

Chapter 21, “Other XML Technologies and Extensions”: There are too many XML-based technologies to cover in a single book. In this chapter, I will introduce you to the XMLWriter and SDO XML Data Access Service extensions as well as show how to work with Ajax and Wireless Application Protocol (WAP) using PHP.


DOWNLOAD THIS BOOK

Apr 21, 2008

Essential XML Quick Reference A Programmer’s

Complete tittle this books is Essential XML Quick Reference A Programmer’s Reference to XML, XPath, XSLT, XML Schema, SOAP, and More.

This book and tutorial is for anyone working with today’s mainstream XML technologies. It was specifically designed to serve as a handy but thorough quick reference that answers the most common XML-related technical questions.
It goes beyond the traditional pocket reference design by providing complete coverage of each topic along with plenty of meaningful examples. Each chapter provides a brief introduction, which is followed by the detailed reference information. This approach assumes the reader has a basic understanding of the given topic.
The detailed outline (at the beginning), index (in the back), bleeding tabs (along the side), and the page headers/footers were designed to help readers quickly find answers to their questions.

Chapter Contents
1 XML 1.0 and Namespaces
2 Document Type Definitions
3 XPath 1.0
4 XPointer, XInclude, and XML Base
5 XSL Transformations 1.0
6 SAX 2.0
7 DOM Level 2
8 XML Schema Datatypes
9 XML Schema Structures
10 SOAP 1.1

Download This Books

Effective XML: 50 Specific Ways to Improve Your XML


Table of content "Effective XML: 50 Specific Ways to Improve Your XML"

Praise for Effective XML
Effective Software Development Series
Titles in the Series

Preface
Acknowledgments

Introduction
Element versus Tag
Attribute versus Attribute Value
Entity versus Entity Reference
Entity Reference versus Character Reference
Children versus Child Elements versus Content
Text versus Character Data versus Markup
Namespace versus Namespace Name versus Namespace URI
XML Document versus XML File
XML Application versus XML Software
Well-Formed versus Valid
DTD versus DOCTYPE
XML Declaration versus Processing Instruction
Character Set versus Character Encoding
URI versus URI Reference versus IRI
Schemas versus the W3C XML Schema Language

Part 1: Syntax
Item 1. Include an XML Declaration
The version Info
The encoding Declaration
The standalone Declaration

Item 2. Mark Up with ASCII if Possible
Item 3. Stay with XML 1.0
New Characters in XML Names
C0 Control Characters
C1 Control Characters
NEL Used as a Line Break
Unicode Normalization
Undeclaring Namespace Prefixes

Item 4. Use Standard Entity References
Item 5. Comment DTDs Liberally
The Header Comment
Declarations

Item 6. Name Elements with Camel Case
Item 7. Parameterize DTDs
Parameterizing Attributes
Parameterizing Namespaces
Full Parameterization
Conditional Sections

Item 8. Modularize DTDs
Item 9. Distinguish Text from Markup
Item 10. White Space Matters
The xml:space Attribute
Ignorable White Space
Tags and White Space
White Space in Attributes
Schemas


Part 2: Structure
Item 11. Make Structure Explicit through Markup
Tag Each Unit of Information
Avoid Implicit Structure
Where to Stop?

Item 12. Store Metadata in Attributes
Item 13. Remember Mixed Content
Item 14. Allow All XML Syntax
Item 15. Build on Top of Structures, Not Syntax
Empty-Element Tags
CDATA Sections
Character and Entity References

Item 16. Prefer URLs to Unparsed Entities and Notations
Item 17. Use Processing Instructions for Process-Specific Content
Style Location
Overlapping Markup
Page Formatting
Out-of-Line Markup
Misuse of Processing Instructions

Item 18. Include All Information in the Instance Document
Item 19. Encode Binary Data Using Quoted Printable and/or Base64
Quoted Printable
Base64

Item 20. Use Namespaces for Modularity and Extensibility
Choosing a Namespace URI
Validation and Namespaces

Item 21. Rely on Namespace URIs, Not Prefixes
Item 22. Don't Use Namespace Prefixes in Element Content and Attribute Values
Item 23. Reuse XHTML for Generic Narrative Content
Item 24. Choose the Right Schema Language for the Job
The W3C XML Schema Language
Document Type Definitions
RELAX NG
Schematron
Java, C#, Python, and Perl
Layering Schemas

Item 25. Pretend There's No Such Thing as the PSVI
Item 26. Version Documents, Schemas, and Stylesheets
Item 27. Mark Up According to Meaning

Part 3: Semantics
Item 28. Use Only What You Need
Item 29. Always Use a Parser
Item 30. Layer Functionality
Item 31. Program to Standard APIs
SAX DOM JDOM

Item 32. Choose SAX for Computer Efficiency
Item 33. Choose DOM for Standards Support
Item 34. Read the Complete DTD
Item 35. Navigate with XPath
Item 36. Serialize XML with XML
Item 37. Validate Inside Your Program with Schemas
Xerces-J
DOM Level 3 Validation


Part 4: Implementation
Item 38. Write in Unicode
Choosing an Encoding
A char Is Not a Character
Normalization Forms
Sorting

Item 39. Parameterize XSLT Stylesheets
Item 40. Avoid Vendor Lock-In
Item 41. Hang On to Your Relational Database
Item 42. Document Namespaces with RDDL
Natures
Purposes

Item 43. Preprocess XSLT on the Server Side
Servlet-Based Solutions
Apache
IIS

Item 44. Serve XML+CSS to the Client
Item 45. Pick the Correct MIME Media Type
Item 46. Tidy Up Your HTML
MIME Type
HTML Tidy
Older Browsers

Item 47. Catalog Common Resources
Catalog Syntax
Using Catalog Files

Item 48. Verify Documents with XML Digital Signatures
Digital Signature Syntax
Digital Signature Tools

Item 49. Hide Confidential Data with XML Encryption
Encryption Syntax
Encryption Tools

Item 50. Compress if Space Is a Problem


Download Effective XML: 50 Specific Ways to Improve Your XML

Applied XML Programming for Microsoft .NET

What Is Applied XML Programming for Microsoft .NET About?

This book explores the array of XML tools provided by the .NET Framework. XML is everywhere in the .NET Framework, from remoting to Web services, and from data access to configuration. In the first part of this book, you'll find in-depth coverage of the key classes that implement XML in the .NET platform. Readers and writers, validation, and schemas are discussed with samples and reference information. Next the book moves on to XPath and XSL Transformations (XSLT) and the .NET version of the XML Document Object Model (XML DOM).

The final part of this book focuses on data access and interoperability and touches on SQL Server 2000 and its XML extensions and .NET Remoting and its cross-platform counterpart—XML Web services. You'll also find a couple of chapters about XML configuration files and XML data islands and browser/deployed managed controls.

Table of Contents This Ebooks and Tutorial:
Applied XML Programming for Microsoft .NET
Introduction

Part I - XML Core Classes in the .NET Framework
Chapter 1 - The .NET XML Parsing Model
Chapter 2 - XML Readers
Chapter 3 - XML Data Validation
Chapter 4 - XML Writers

Part II - XML Data Manipulation
Chapter 5 - The XML .NET Document Object Model
Chapter 6 - XML Query Language and Navigation
Chapter 7 - XML Data Transformation

Part III - XML and Data Access
Chapter 8 - XML and Databases
Chapter 9 - ADO.NET XML Data Serialization
Chapter 10 - Stateful Data Serialization

Part IV - Applications Interoperability
Chapter 11 - XML Serialization
Chapter 12 - The .NET Remoting System
Chapter 13 - XML Web Services
Chapter 14 - XML on the Client
Chapter 15 - .NET Framework Application Configuration

Download Applied XML Programming for Microsoft .NET
Filetype : chm
Page : (696 pages)
Pub Date : 2003

Apr 19, 2008

XML programming in Java technology, Part 2

In an earlier tutorial ("XML programming in Java technology, Part 1"), I showed you the basics of XML parsing in the Java language. I covered the major APIs (DOM, SAX, and JDOM), and went through a number of examples that demonstrated the basic tasks common to most XML applications. This tutorial will look at more difficult things that weren't covered before, such as:
• Getting and setting parser features
• Working with namespaces
• Validating XML documents

As in the introductory tutorial, the APIs I'll cover are:
• The Document Object Model (DOM), Levels 1, 2, and 3
• The Simple API for XML (SAX), Version 2.0
• JDOM, a simple Java API created by Jason Hunter and Brett McLaughlin
• The Java API for XML Processing (JAXP)

I'll also cover several approaches to validation, including W3C XML Schema, RELAX
NG, and Schematron.

About the examples
Most of the examples here will work with the Shakespearean sonnet that appeared in the last tutorial. The structure of this sonnet is:









[14 elements]




In the various sample programs, some versions of this document will have namespaces, and some will use DTDs, W3C XML Schemas, or other schema languages for validation. For the complete examples, see the following files:
• sonnet.xml
• sonnet.dtd (download to view in a text editor)
sonnetNamespaces.xml
sonnet.xsd
sonnetSchema.xml
sonnet.rng
sonnetRules.xsl
sonnetSchematron.xml
As an alternative, download x-java2_code_files.zip to view these files in a text editor.

Download this tutorial

XML programming in Java technology, Part 1

About this tutorial

Over the last few years, XML has become a universal data format. In this updated tutorial, I'll show you the most common programming interfaces for working with XML documents in the Java language. The most common XML processing task is parsing an XML document. Parsing involves reading an XML document to determine its structure and contents. One of the pleasures of XML programming is the availability of open-source, no-cost XML parsers that read XML documents for you. This tutorial focuses on creating parser objects, asking those parsers to process XML files, and handling the results. As you might expect, you can do these common tasks in several different ways; I'll examine the standards involved as well as when you should use one approach or another.

Programming interfaces
A number of programming interfaces have been created to simplify writing Java programs that process XML. These interfaces have been defined by companies, by standards bodies, and by user groups to meet the needs of XML programmers. In this tutorial, I'll cover the following interfaces:
• The Document Object Model (DOM), Level 2
• The Simple API for XML (SAX), Version 2.0
• JDOM, a simple Java API created by Jason Hunter and Brett McLaughlin
• The Java API for XML Processing (JAXP)

The first three of these four interfaces (DOM, SAX, and JDOM) define how the
contents of an XML document are accessed and represented. JAXP contains classes for creating parser objects. To create DOM or SAX parsers, you'll use JAXP. When you use JDOM, the JDOM library uses JAXP under the covers to create a parser. To sum it all up:
• You use DOM, SAX, or JDOM to work with the contents of an XML document.
• If you use DOM or SAX, you use JAXP to create a parser.
• If you use JDOM, the JDOM library creates a parser for you.

I'll explore the design goals, strengths, and weaknesses of each of these APIs, along
with a bit of their histories and the standards bodies that created them.

Download this tutorial

XQuery Java API (tutorial)

This API provides the methods for compiling and executing XQuery/XPath scripts from Java and exploiting the results. This is very similar to using the SQL language through a Java interface like JDBC.
Using XQuest's implementation of XQuery provides a high-level query language and extended processing capabilities. It is therefore advisable to implement the largest possible part of an application with XQuery, and use Java only for retrieving final results. This is especially true when connecting to a remote server, because such an approach will likely minimize the network traffic.
The API is actually used in the GUI and Command-line Interface applications provided with XQuest, as well as in the "Server Pages" extension, which embeds the XQuery engine in a Servlet.

The API allows:
• Creation and setup of a compilation and execution environment (which implements both the static context and dynamic context defined in the XQuery Specifications). These environments are basically provided by an interface named XQueryConnection Creation of Expressions from a XQueryConnection (interfaces XQueryExpression and XQueryPreparedExpression ). Such expressions are similar to Statements found in database connectivity interfaces like JDBC. Expressions receive a Query (i.e. a XQuery script) which is compiled and then executed once or several times.

An Expression is itself a context which inherits the environment provided by the connection, and can then be set up individually before execution. In particular, it is possible to bind global variables of the XQuery expressions to initial values.

• Exploitation of results of Expression evaluations.

The result sets are iterators, since the XQuery/XPath2 language can generally return se- quences of Items. Items are either atomic values (such as numbers or strings), or Nodes, which describe the structure of XML documents and data. The properties and relationships of Nodes are de- scribed in a section of the XQuery/XPath2/XSLT2 specifications which is called the Data Model. A section of the present document is dedicated to the Data Model interfaces, which handle Nodes.

For calling Java methods from within XQuery expressions, see the Java Binding section of the XQuery Extensions documentation.
For dealing specifically with XML databases (XML Libraries), see the XML Library API


Download

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)

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