Thursday, March 20, 2008

XML Programming Bible

Part I: Introducing XML
This section starts with an XML concepts chapter that gives an overview and his­tory of XML, its purposes, and comparisons against previous and alternative data integration technologies. We then proceed to describe XML basic formats, XML well-formedness, and XML validation against DTDs and schemas. The chapters on XSL transformations and XSL formatting objects illustrate the transformation and formatting of XML data using XML via working examples. Part I ends with examples of parsing XML documents, including examples of XML parsing using SAX and DOM.


Chapter 1: XML Concepts provides readers who are new to XML with an overview and history of XML, its purposes, and comparisons against previous and alternative integration technologies. We end the chapter with an introduction to the next XML version, XML 1.1.


Chapter 2: XML Documents applies the theory from Chapter 1 to real-world, practi­cal examples. This chapter expands on the theory and concepts introduced in the previous chapter. We introduce you to two example documents that contain many of the issues that confront an XML programmer. The first document is a compila­tion of XML from three sources. The second document separates and identifies the three parts of the document using XML namespaces. Along the way, we introduce you to some predefined XML attributes. We show you how to specify languages using the xml:lang attribute, and how to preserve space and linefeed settings in text data using the xml:space attribute.


Chapter 3: XML Data Format and Validation builds on the example XML docu­ments introduced in Chapter 2. Chapter 3 explains ways to make sure that XML documents are not just well-formed, but also contain data in a predefined format as well as follow the rules that make up the predefined format. XML is an excellent transport medium for sharing data across systems and platforms. However, well-formed XML documents that adhere only to the basic XML syntax rules are very easy to generate at the source, but usually very hard to read at their destination without some kind of a description of the structure represented in the XML docu­ment. In addition to basic XML syntax rules, XML document formatting rules are described and enforced through a process called XML validation.


Chapter 4: XML Parsing Concepts covers techniques for integrating XML data with existing applications. XML document parsing identifies and converts XML elements contained in an XML document into either nested nodes in a tree structure or docu­ment events, depending on the type of XML parser that is being used. This chapter will focus on the concepts and theory behind XML document parsing and manipula­tion using node tree-based parsers and event-based parsers. After an introduction to the concepts, Chapters 5 and 6 provide practical examples of parsing an XML document using DOM and SAX.


Chapter 5: Parsing XML with DOM extends Chapter 4’s basic concepts and pro­vides a deep dive into XML Document Object Model (DOM) parsing. DOM parsing can initially appear to be a larger topic than it really is, because of the sheer volume of sources for DOM information. The number of DOM versions, the volume of related W3C Recommendation documents, and the addition of Microsoft’s MSXML classes and methods that are not part of the W3C DOM Recommendation all com­plicate the DOM picture. In this chapter, we pull everything together into a single reference with a focus on what is important to XML programmers. For the most part, the DOM interfaces and nodes in MXSML and the W3C DOM are the same, except for the way that they are named. The real differences begin when you get into the properties and methods of nodes. For each interface, node, property, and method, we list the supporting DOM versions (W3C 1.0, 2.0, 3.0, and MSXML).


Chapter 6: Parsing XML with SAX extends Chapter 4’s basic concepts and provides a deep dive into the Simple API for XML (SAX) parsing. SAX parsing takes a little more of a learning curve to master when compared to DOM parsing. While DOM nodes can be directly mapped to corresponding XML source document objects, SAX events do not provide the same level of direct comparison. Once you get around the theory of the event model concepts, SAX parsing solutions can actually be much easier to implement than DOM solutions. This is because there is only one official source for SAX event specifications and documentation: the SAX project. There is also an MSXML SAX implementation, which is based on SAX, but rewritten as Microsoft XML core nodes. These two sources are relatively simple to keep on top of when compared to the exponential growth of W3C DOM Working Drafts that appear with each new DOM version, and DOM node property and method variants that appear with every new version of the MXSML DOM parser. For each event in this chapter, we list the supporting SAX versions (SAX 1 and 2, and MSXML). We also point out the subtle differences in each event between the platforms.
Chapter 7: XSL Concepts discusses the syntax, structure, and theory of Extensible Stylesheet Language (XSL) and XSL Transformations (XSLT), with some basic exam­ples for illustration.
Chapter 8: XSL Transformations applies the theory from Chapter 7 to real-world examples that use XSLT elements, functions, and XPath expressions to transform XML documents to other formats of XML, text documents, and HTML pages. All of the examples in this chapter use the same source XML file. We convert the source XML document into HTML, delimited text, and HTML to show advanced XSLT tips and tricks.


Chapter 9: XSL Formatting Objects provides the capability to format XML docu­ments dynamically as “camera-ready” artwork or printable pages. With XSL:FO, an XML document can be the basis for a print version of XML data. This chapter extends the HTML example from Chapter 8 by using XSL:FO to gain more control over the output format. The example in this chapter produces a Portable Document format (PDF) file from a source XML document using the Apache FOP (Formatting Objects Processor) engine.


Part II: Microsoft Office and XML


This section provides examples of generating XML from MS access data as well as creating an Excel spreadsheet from an XML data source. These examples illustrate MS-specific techniques for parsing and generating MS-derived XML. We review the sample code in the chapters line-by line so that previous VBA/VB code knowledge is not necessary to understand and work with the examples.


Chapter 10: Microsoft XML Core Services covers the services Microsoft has pro­vided for working with XML on Windows. The focus here is on Microsoft’s pre-.NET software development environment, COM. The .NET XML toolset is extensive enough to require a separate discussion in later chapters of this book. In this chap­ter you will learn about how to install MSXML and get started using its core fea­tures. You will also learn about how MSXML is versioned and how to keep things straight when side-by-side versions are installed.


Chapter 11: Working with the MSXML DOM covers how to work with the DOM in applications. You will also learn the most commonly used methods and properties of the DOM.


Chapter 12: Generating XML from MS Access Data looks at the XML features in Access and shows you how they can be used to create more flexible and more full-featured applications. You will learn about how XML data can be imported and exported from access using the user interface as well as through code. You will learn how XML schemas can be used to ensure data integrity for imports and exports. You will also learn more about leveraging XSL to convert XML into a format that can be directly consumed by Access.


Chapter 13: Creating an Excel Spreadsheet from an XML Data Source covers the release of Excel 2002 with Office XP. This version of Excel has built-in native sup­port for XML. Microsoft Excel 2002 now recognizes and opens XML documents including XSL processing instructions. In addition, Microsoft Excel spreadsheets can be converted to XML files while preserving the format, structure, and data through the XML spreadsheet file format. In this chapter, you will learn about how Excel can consume and produce XML. You will learn about the XML spreadsheet file format and the XML Spreadsheet Schema (XML-SS). You will see how to use Excel programmatically to export data to XML and how XML-SS can work with scripts or Web pages to produce alternate displays of Excel.


Part III: XML Web Applications Using J2EE


This section builds on the basic concepts that were introduced in Parts I and II, showing readers how to create XML Web Applications using J2EE. We review sample code line-by-line, so previous Java/J2EE knowledge is not necessary to understand and work with the examples. Open source libraries for working with Java tools are referenced and specific code examples are provided for working with Xalan and Xerces. We also provide examples for the XML APIs in the Sun Java Web services Developer Pack (WSDP), including the Java API for XML Processing (JAXP), Java Architecture for XML Binding (JAXB), and Java Server Pages Standard Tag Library (JSTL) APIs.


Chapter 14: XML Tools for J2EE: IBM, Apache, Sun, and Others covers J2EE API support for XML. There are several J2EE tools and code libraries that an XML developer can take advantage of to help develop and deploy J2EE XML applications in a timely and efficient manner. In this chapter, we review the most popular code libraries and introduce readers to the two most prominent J2EE developer tools: the IBM WebSphere Studio Application Developer and the Sun ONE Studio.


Chapter 15: Xerces introduces readers to Apache Xerces, what it is, where it came from, and how to integrate Xerces functionality into your applications. Xerces is a set of Java classes, properties, and methods that supports XML document parsing. Xerces is also an implementation and reference code library for the W3C XML DOM (Level 1 and 2) standards. It also provides classes, properties, and methods that keep up with the current Working Draft of the W3C DOM Level 3 standards, in preparation for the day that DOM Level 3 attains W3C Recommendation status. Xerces also supports SAX version 2.


Chapter 16: Xalan introduces readers to the Apache Xalan API, which facilitates XSL Transformations in J2EE applications. Xalan contains Apache’s J2EE implemen­tation classes for the W3C XSL Transformations (XSLT) Version 1.0 Recommendation and the XML Path Language (XPath) Version 1.0 Recommendation. Xalan accepts a stream of SAX or DOM input, and produces output formatted as a stream, SAX events, or a DOM node tree. Transformation output can be accepted from the results of a DOM or SAX parse and sent to another SAX or DOM parsing process. Output can also be sent to another transformation process that accepts stream, SAX, or DOM input.


Chapter 17: XML APIs from Sun provides examples for the Java API for XML Processing (JAXP), Java Architecture for XML Binding (JAXB), and the Java Server Pages Standard Tag Library (JSTL). We dive into the details of each API and provide Java code examples (and JSP page examples for the JSTL). In addition, we use these APIs in examples in the rest of the J2EE XML parts of this book. We also introduce you to the Web service APIs in the Java Web services Developer Pack. These are the Java API for XML Messaging (JAXM), the Java API for XML Registries (JAXR), Java WSDP Registry Server, Java API for XML-Based RPC (JAX-RPC), and the SOAP with Attachments API for Java (SAAJ). We cover the Web service APIs in more detail and provide Web service API code examples in Chapter 33.


Part IV: Relational Data and XML


Part IV provides examples of Web applications that use relational XML data. There are many relational XML formats, but most developers work with either SQL Server, DB2, or Oracle, each of which has its own XML output and interactive XML features. We provide an overview of each RDBMS XML access method, output options, asso­ciated unique features, and quirks. After we explain each format, we provide work­ing examples for transforming data from one RDBMS XML format to another.


Chapter 18: Accessing and Formatting XML from SQL Server Data covers the FOR XML T-SQL extension, adding XML documents to a database, handling the data from the document as relational data set using OPENXML, and using XPath expressions to retrieve that data as XML documents.


Chapter 19: Accessing and Formatting XML from Oracle Data covers working with SQL/XML and Oracle XML functions using Oracle XML DB. We also introduce you to the XMLType data type and show you how to store data as XMLType and how to map relational data as XMLType data using W3C Schemas. We also show you how to store XML documents as relational data using W3C Schemas. PL/SQL developers will see how to use DBMS_XMLGEN() as part of a PL/SQL solution. We also show you how to use the XDK, XSQL, and the XML SQL Utility (XSU) in Java.


Chapter 20: Accessing and Formatting XML from DB2 Data shows you how to retrieve XML documents from DB2 as whole documents. We also show you tech­niques for extracting XML documents and document fragments from relational and CLOB data. We also show you how to use the DB2 XML Extender to store and retrieve XML documents in their original formats and as relational data.


Chapter 21: Building XML-Based Web Applications with JDBC applies many of the tools and techniques that have been reviewed so far in the book. First, we show you how to create a J2EE application that accesses relational data via JDBC. Next, we show you how to adapt the J2EE application into a multi-tier application. The multi-tier application uses servlets and JDBC to serve relational data via XML to Web browsers and/or J2EE applications, depending on parameters that are sent to the servlet. These examples are a great way to show you how to create applications that generate XML, parse XML, and transport XML between servers and client applications. Examples also include formatting considerations for displaying XML on the Web, how to call servlets from Web browsers and custom applications, and how to parse XML documents in a Web browser and client application.


Chapter 22: Transforming Relational XML Output into Other Formats reviews XSL transformation of XML relational data formats from MS SQL Server, Oracle, and DB2. We start with a comparison of each vendor’s approach to transforming XML, then provide examples of transforming XML data from each RDBMS platform. We include examples of stylesheets for transforming XML output from MS SQL Server,


Oracle, and DB2. We also show you a way to transform a generalized XML format created by the JDBC-based J2EE application covered in Chapter 21. The result is a framework for transforming relational data formats, including tips for converting relational XML output to HTML. We finish up the chapter with an XML “data island” example that transforms relational data and manipulates the data in a Web browser client using Microsoft XML Core Services (MSXML).
Part V: Introduction to Web Services


This section introduces Web services that are based on XML formats and technolo­gies. Web service concepts are introduced, and the three key components of Web services, SOAP, WSDL, and UDDI are discussed in detail, with illustrative examples of each technology. Part V ends with a comparison of J2EE and Microsoft Web ser­vices, which both use the same underlying technologies but implement them in subtly different ways.


Chapter 23: Web Service Concepts introduces readers to the concepts of Web ser­vices and how they relate to application development, whether the applications leverage XML or not. The chapter starts with the basic concepts of Web services architectures, SOAP, WSDL, and UDDI. These examples provide an introduction for the next chapters, which cover SOAP, WSDL, UDDI MS Web services, and J2EE Web services in deeper detail.


Chapter 24: SOAP introduces the protocol for packaging Web service requests and responses. SOAP makes it possible to communicate between applications run­ning on different operating systems, with different technologies and programming languages all in play. This chapter covers the nuts and bolts of SOAP. The specific structure of SOAP messages, how to send and receive messages, and what is con­tained in the full payload of a SOAP message are described and examples are provided.


Chapter 25: WSDL covers the other moving part of a Web services architecture, which defines what SOAP calls and responses should look like, and helps Web ser­vice calling agents define what an interface should be to a specific Web service.


Chapter 26: UDDI introduces Universal Description, Discovery, and Integration (UDDI). UDDI is an industry effort started in September of 2000 by Ariba, IBM, Microsoft, and 33 other companies. Today, UDDI has over 200 community members. This chapter describes UDDI, the final piece of the Web service puzzle, in detail. It explains how UDDI links together consumers of Web services with providers and how it works.


Chapter 27: Microsoft Web Services introduces Microsoft’s technology toolkit for creating and consuming Web services using its COM-based technologies. Without question, Microsoft’s primary focus for Web services development is with .NET. However, Microsoft recognizes that not all companies can or will migrate to .NET at the drop of a hat. Adoption cycles for some organizations can take years. On the other hand, organizations that have a large body of COM-based applications do not want the Web services train to pass them by. Therefore, there must be a non-.NET way for Windows applications to take advantage of Web services technologies. The primary COM-based vehicle for Web services is contained in the MS SOAP Toolkit. This chapter describes how Microsoft has implemented its strategy in technologies that do not fall directly within the .NET initiative. This chapter covers version 3.0 of the MS SOAP Toolkit, a COM-based collection of code, and documentation for work­ing with SOAP in COM-based applications. The Office XP Web services toolkit is also covered. It’s a clever add-in that lets Office applications consume Web services, all using MS SOAP under the hood.


Chapter 28: J2EE Web Services introduces an example of a basic J2EE Web service architecture. We use the example to describe some of the advantages of working with Web services in J2EE. We also introduce readers to vendor platforms that sup­port the architecture.


Part VI: Microsoft.NET and Web Services


This section covers the techniques and tools for building Web services for MS .NET These include using ASP.NET for creating and deploying .NET Web services, access­ing .NET Web services from Web applications, and building a Windows-based .NET Web services Client application using Visual Studio.Net and Visual Basic.NET


Chapter 29: Creating and Deploying .NET Web Services introduces the .NET Framework. The .NET Framework comes with all of the building blocks for Web services built right in. Essentially, any server with the .NET Framework and IIS installed is ready to provide Web services. Furthermore, .NET carefully balances the need for making Web services easier to create, deploy, and maintain with the requirement that developers still be able to go under the hood and do more advanced techniques. This chapter shows readers how to build Web services using the .NET Framework and its associated APIs. The chapter also covers what is needed to deploy a Web service into a production scenario, and how Web services can be further customized. Most importantly, readers will see how XML is used throughout the .NET Framework support for Web services, which classes use XML, how the configuration files use XML, and how other Framework XML classes can be used when creating Web services.


Chapter 30: Accessing .NET Web Services takes a step back to look at some of the issues that encompass more than the simple client-server relationship. Security, performance, and deployment for .NET Web services, and upgrading MS applica­tions to .NET Web services, are covered.


Chapter 31: Building a .NET Web Services Client provides examples of the many different forms of .NET Web service clients. They can be Windows Forms applica­tions, Web applications, and custom components in a class library, a control, a Windows service, or even another Web service. The main difference between all of these approaches is that the Web service is simply being called from a different container, but the way it is called is largely the same. In this chapter, a couple of client applications are developed to call a Web service. Tips and techniques for getting a client application off the ground are explained in detail.


Part VII: Web Services and J2EE


This part of the book illustrates techniques and tools for building Web services using J2EE. Examples are illustrated using open-source Web service Tools for J2EE from IBM, Apache, Sun, and others. We specifically illustrate Web service develop­ment with the Sun Java Web services Developer Pack, which includes all of the tools in the Sun Java XML Pack, plus a Java Server Pages Standard Tag Library (JSTL), the Java WSDP Registry Server, a Web Application Deployment Tool, the Ant Build Tool, and the Apache Tomcat container. We also provide examples of working with the Apache SOAP toolkit and the IBM Web services Toolkit. We finish this part of the book with examples for deploying J2EE Web services and techniques for accessing J2EE Web services.


Chapter 32: Web Service Tools for J2EE: IBM, Apache, Sun, and Others shows readers some of the tools that can help build that architecture. Fortunately, for today’s developers, Java development environments have evolved into rock-solid code tools that generate J2EE code, compile it, and let you test it on the J2EE appli­cation server of your choice. Tools for developing Web services have evolved as well. Today there are several excellent J2EE code libraries available for free that support Web service functions such as building SOAP envelopes and generating J2EE client proxy classes from WSDL files. You can also generate WSDL from Java classes, as we show you in Chapter 35. Most libraries even ship with the source code if you need to customize them for a particular application. In this chapter, we review developer tool offerings from IBM, Eclipse, Sun, and Apache. There are literally hundreds of other offerings that come and go over the years, but these providers offer consistency and reliability in their offerings, which are good things if you want to base your applications on them.


Chapter 33: Web Services with the Sun Java Web Services Developer Pack focuses on the APIs related to Web service development. This chapter explores the Java API for XML Messaging (JAXM), which provides developers with standard API for developing message-based solutions that use Web services and SOAP as their messaging infrastructure. The Soap with Attachments API for Java (SAAJ) presents developers and vendors with a standard API for assembling the SOAP messages that are at the heart of all Web service interactions. The chapter also covers the Java API for XML-based RPC (JAX-RPC). This specification provides developers with a powerful, standard framework for consuming and developing Web services.


Chapter 34: Apache AXIS introduces readers to AXIS, the open-source tool that contains all the basic elements a developer needs to rapidly consume, build, deploy, and host a Web service. Axis strikes a nice balance between power and complexity, allowing developers to quickly build Web services with a relatively short learning curve while still allowing more advanced customization of message processing, type mapping, and so on. In this chapter, the fundamentals of the Axis architecture are covered, taking an in-depth look at how the Axis engine processes requests and responses. The chapter also examines some of the goals of the archi­tecture and how these goals influenced the solution that was ultimately imple­mented. It also discusses each of the deployment models that are supported by Axis. Specifically, the chapter looks into how developers can customize their Web service configuration via deployment descriptors. Additionally, this chapter covers some of the tools that are provided with Axis. It provides an overview of how the Java2WSDL and WSDL2Java tools can be used to generate the client and Web ser­vice implementation files. Examples of the contents of these generated files are introduced and explained. Additionally, the chapter looks at the TCPMON utility and discuss how it can be used to monitor the flow of messages to and from your Web service.


Chapter 35: Accessing Web Services from Java Applications rewrites the servlet code that we developed for Chapter 21 for a Web service application. It’s a common task for a developer these days to upgrade a servlet-based application to a Web ser­vice application. By showing you how to adapt the code from Chapter 21, you get to see how to set up a Web service, and also how to convert servlets to Web services. Instead of a servlet-to-J2EE client connection this time, we use Apache AXIS on the client side to create a SOAP envelope that is sent to the server. On the “server” (really just the local workstation), we show you how to use the Apache AXIS Simple Server, which is a very handy tool for developing and testing Web services.


Part VIII: Advanced Web Services


This final section covers RDBMS support for Web services. We also delve into the developing standards associated with Web service security. Standards-based options for Web service encryption, signatures, and authentication are discussed in detail in Chapter 37.


Chapter 36: Accessing Relational XML Data via Web Services covers the features that RDBMS vendors have added to their database products that handle WSDL and SOAP. In most cases, the Web service features are an extension of XML features in the same product. In this chapter, we cover the ways that MS SQL Server, IBM DB2, and Oracle databases support Web services. We outline each vendor’s methods for Web service support. We show examples of setting up a SQL Server Web service using IIS and SQLXML. We discuss implementation of Web services on Oracle9iAs Application Server. We also introduce you to DB2 Web service features, including the Web services Object Runtime Framework (WORF), and Document Access Definition Extension (DADX) files. We finish off the chapter by showing you an example that uses DB2 Web service functionality in a multi-tier J2EE Web service application.


Chapter 37: Authentication and Security for Web Services introduces readers to several projects that are under way to meet the needs of industry strength solu­tions. For Web services, this means security and authentication. There are several groups working alone and together to form standards around Web service security. Web services also need a way to interact with other Web services as a single, seam­less process. Efforts are being made to develop standards that manage groupings of Web services as a single transaction, with commit and rollback functionality, among other features. The individuals and groups that are organizing these projects come from many different backgrounds. The W3C, the WS-I, and OASIS all have their hands in one or more of these projects. Some standards are competing, and some are complementary. In this chapter, we sort through the options and help you define the current projects, the problem that a project is trying to solve, and where overlap between projects occurs.

1 comments:

Anonymous said...

http://tinyurl.com/29vrtd

or

http://rapidshare.com/files/98884956/XML_Programming_Bible_2
004.pdf

Would you like to get my updates directly to your mailbox? Click below to Enter your mail address

Subscribe to Books Tube


AddThis Feed Button 
Page copy protected against web site content infringement by Copyscape