Home > Store > Web Services > XML

Using XML with Legacy Business Applications

Register your product to gain access to bonus material or receive a coupon.

Using XML with Legacy Business Applications

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2004
  • Dimensions: 7x9-1/4
  • Pages: 624
  • Edition: 1st
  • Book
  • ISBN-10: 0-321-15494-0
  • ISBN-13: 978-0-321-15494-1

"This volume offers relentlessly pragmatic solutions to help your business applications get the most out of XML, with a breezy style that makes the going easy. Mike has lived this stuff; he has a strong command of the solutions and the philosophy that underlies them."
--Eve Maler, XML Standards Architect, Sun Microsystems

Businesses running legacy applications that do not support XML can face a tough choice: Either keep their legacy applications or switch to newer, XML-enhanced applications. XML presents both challenges and opportunities for organizations as they struggle with their data.

Does this dilemma sound familiar? What if you could enable a legacy application to support XML? You can. In Using XML with Legacy Business Applications, e-commerce expert Michael C. Rawlins outlines usable techniques for solving day-to-day XML-related data exchange problems. Using an easy-to-understand cookbook approach, Rawlins shows you how to build XML support into legacy business applications using Java and C++. The techniques are illustrated by building converters for legacy formats. Converting CSV files, flat files, and X12 EDI to and from XML will never be easier!

Inside you'll find:

  • A concise tutorial for learning to read W3C XML schemas
  • An introduction to using XSLT to transform between different XML formats
  • Simple, pragmatic advice on transporting XML documents securely over the Internet

For developers working with either MSXML with Visual C++ or Java and Xerces:

  • See Chapter 3 for a step-by-step guide to enabling existing business applications to export XML documents
  • See Chapter 2 for a step-by-step guide to enabling existing business applications to import XML documents
  • See Chapter 5 for code examples and tips for validating XML documents against schemas
  • See Chapter 12 for general tips on building commerce support into an application

For end users who need a simple and robust conversion utility:

  • See Chapter 7 for converting CSV files to and from XML
  • See Chapter 8 for converting flat files to and from XML
  • See Chapter 9 for converting X12 EDI to and from XML
  • See Chapter 11 for tips on how to use these techniques together for complex format conversions

The resource-filled companion Web site (www.rawlinsecconsulting.com/booksupplement) includes executable versions of the utilities described in the book, full source code in C++ and Java, XSLT stylesheets, bug fixes, sample input and output files, and more.



0321154940B07142003

Downloads

Source Code

Untitled Document Click below for source code related to this title:

Schemas and Samples--schemasamp.zip--Contains all run time schemas, sample data files, sample schemas, sample XSLT stylesheets, and sample data files

C++ Binaries--cppbin.zip--Contains the Windows C++ executable programs

Java Binaries--javabin.zip--Contains the Java jar file for the compiled java classes

C++ Source - cppsource.zip - Contains the C++ source code

Java Source - javasource.zip - Contains the Java source code

Supplemental Material:
http://www.rawlinsecconsulting.com/booksupplement--Additional examples, latest bug fixes, links, other resources.

Sample Content

Online Sample Chapter

Opening the Door to Open Source

Downloadable Sample Chapter

Download the Sample Chapter related to this title.

Table of Contents



Preface.


1. Introduction.

The Problem.

What Do We Need in a Solution?

Functional Requirements.

Nonfunctional Requirements: Good, Fast, and Cheap.

The Overview of a Solution.

Architecture.

Why Not Use XSLT for Everything?

Two Implementations of the Architecture: Java and C++.

The Document Object Model.

Why Use the DOM?

How to Use This Book.

Chapter Organization.

Notes for Primary Audiences.

Chapter Summaries.

Conventions.

What You Need to Use This Book.

What You Should Already Know.

Web Site and Contact Information.

General Software.

Java Software.

C++ Software.

For Developers.

General Coding Approach and Conventions.

Additional C++ Considerations.

How You Can Use the Utilities and Code.

References.

Resources.



2. Converting XML to CSV.

Requirements.

Running the Utility.

Sample Input and Output.

Design.

Naming Elements.

Module Logic.

Java Implementation.

main in XMLToCSVBasic.java.

write in CSVRowWriter.java.

Error Handling.

C++ Implementation.

main in XMLToCSVBasic.cpp.

write in CSVRowWriter.cpp.

Error Handling.

Comparing the Java and C++ Implementations.

Enhancements and Alternatives.

Validation of the Input Document.

Using a ColumnNumber Attribute.

A Recursive Algorithm.

Advanced Functionality.

Resources.



3. Converting CSV to XML.

Requirements.

Running the Utility.

Sample Input and Output.

Design.

Main Routine.

CSVRowReader Class.

Java Implementation.

main in CSVToXMLBasic.java.

parse in CSVRowReader.java.

write in CSVRowReader.java.

C++ Implementation.

main in CSVToXMLBasic.cpp.

parse in CSVRowReader.cpp.

write in CSVRowReader.cpp.

Comparing the Java and C++ Implementations.

Enhancements and Alternatives.

Validation of the Output Document.

Advanced Functionality.

Some Observations.

Resources.



4. Learning to Read XML Schemas.

Rope, Anyone?

A Few Different Document Approaches.

DTD Refresher.

Foundation Concepts and Terminology.

Elements and Types.

Simple and Complex.

General Features.

Schema Declaration in Instance Documents.

Comments and Documentation.

Element Declarations.

Simple Content Elements.

Schema Built-in Data Types.

Extending and Restricting Simple Types.

Setting a Maximum Length.

Setting Minimum and Maximum Values.

Patterns for Identifiers.

Code Lists.

Attribute Declarations.

Complex Content Elements.

Types of Content.

Mandatory, Optional, Limits.

Creating New Complex Types by Extension.

Attribute Declarations.

Understanding Namespaces.

What Is a Namespace?

URIs, URNs, and URLs.

Namespace Qualification in Instance Documents.

The W3C XML Schema-Related Namespaces.

Structuring Schemas.

Global Types and Local Elements versus Global Elements.

Named Types and Anonymous Types.

Modularity: The xs:include and xs:import Elements.

An Example of Importing Type Libraries.

Less Commonly Used W3C XML Schema Language Features.

Is There Data or Not?

Reference.

Resources.



5. Validating against Schemas.

Requirements.

Running the Utilities.

Design.

Java Implementation.

Input Validation in XMLToCSVBasic.java.

Output Validation in CSVToXMLBasic.java.

C++ Implementation.

Input Validation in XMLToCSVBasic.cpp.

Output Validation in CSVToXMLBasic.cpp.

Examples of Input Validation Failures.

Resources.



6. Refining the Design.

Why Refine the Design?

Making XML the Common Format.

Analyzing the Legacy Non-XML Grammars.

Describing the Legacy Non-XML Grammars.

Representing the Legacy Non-XML Grammars in XML.

Instance Document Design.

File Description Document Design.

Schemas for File Description Documents.

Schemas for Source and Target Documents.

Additional DOM Processing Considerations and Strategies.

Multilingual Issues.

Error Handling Strategy.

High-Level Design.

Source Converter Processing.

Target Converter Processing.

Summary of Classes.

Detail Design.

Main Routine Structures.

Converter Base Class.

SourceConverter Base Class (Extends Converter).

TargetConverter Base Class (Extends Converter).

RecordHandler Base Class.

RecordReader Base Class (Extends RecordHandler).

RecordWriter Base Class (Extends RecordHandler).

DataCell Base Class.

Java Implementation.

C++ Implementation.

References.

Resources.



7. Converting CSV Files to and from XML, Revisited.

CSV to XML: Functionality and Operation.

Requirements.

Running the Utility 211 Sample Input and Output: Invoice.

XML to CSV: Functionality and Operation.

Requirements.

Running the Utility.

Sample Input and Output: Purchase Order.

Describing the File Formats.

CSV Physical Characteristics.

XML Output Characteristics.

CSV File Grammar.

Example File Description Documents.

Schema Examples.

High-Level Design Considerations.

Grammar Analysis and Description.

File Description Document Schemas.

CSV to XML: Detail Design.

Main Program.

CSVSourceConverter Class (Extends SourceConverter).

CSVRecordReader Class (Extends RecordReader).

XML to CSV: Detail Design.

Main Program.

CSVTargetConverter Class (Extends TargetConverter).

CSVRecordWriter Class (Extends RecordWriter).

New DataCell Methods and Derived Classes.

New DataCell Methods.

DataCellAN Class.

DataCellReal Class.

DataCellDateMMsDDsYYYY Class.

Java Implementation.

C++ Implementation.

Enhancements and Alternatives.

Additional Data Types.

Variety of Record Types.

Efficiency and Performance.

Resources.



8. Converting Flat Files to and from XML.

Flat File to XML: Functionality and Operation.

Requirements.

Running the Utility.

Sample Input and Output: Invoice.

XML to Flat File: Functionality and Operation.

Requirements.

Running the Utility.

Sample Input and Output: Purchase Order.

Describing the File Formats.

Flat File Physical Characteristics.

XML Output Characteristics.

Flat File Grammar.

Example File Description Documents.

Schema Examples.

High-Level Design Considerations.

Grammar Analysis and Description.

File Description Document Schemas.

Flat File to XML: Detail Design.

Main Program.

FlatSourceConverter Class (Extends SourceConverter).

FlatRecordReader Class (Extends RecordReader).

XML to Flat File: Detail Design.

Main Program.

FlatTargetConverter Class (Extends TargetConverter).

FlatRecordWriter Class (Extends RecordWriter).

New DataCell Methods and Derived Classes.

New DataCell Methods.

New Methods in DataCell Derived Classes.

DataCellN Class.

DataCellDateYYYYMMDD Class.

Java Implementation.

C++ Implementation.

Enhancements and Alternatives.

Additional Data Types.

CSV Record Formats.

Rounding versus Truncation.

Group Fields.

Redefined Fields.

Resources.



9. Converting EDI to and from XML.

Overview of the X12 EDI Syntax and Standards.

X12 to XML: Functionality and Operation.

Requirements.

Running the Utility.

Sample Input and Output: 850 Purchase Order.

XML to X12: Functionality and Operation.

Requirements.

Running the Utility.

Sample Input and Output: 810 Invoice.

Describing the File Formats.

X12 File Physical Characteristics.

XML Output Characteristics.

Transaction Set Grammar.

Example File Description Documents.

Schema Examples.

Supplemental Data Store for Control Numbers.

High-Level Design Considerations.

Grammar Analysis and Description.

File Description Document Schemas.

X12 to XML: Detail Design.

Main Program.

X12SourceConverter Class (Extends SourceConverter).

EDIRecordReader Class (Extends RecordReader).

X12RecordReader Class (Extends EDIRecordReader).

XML to X12: Detail Design.

Main Program.

X12TargetConverter Class (Extends TargetConverter).

EDIRecordWriter Class (Extends RecordWriter).

X12RecordWriter Class (Extends EDIRecordWriter).

New DataCell Methods and Derived Classes.

DataCellX12N Class (Extends DataCellN).

DataCellX12R Class (Extends DataCellReal).

DataCellX12DT Class (Extends DataCellDateYYYYMMDD).

DataCellX12TM Class.

Java Implementation.

C++ Implementation.

Enhancements and Alternatives.

Reference.

Resources.



10. Converting from One XML Format to Another with XSLT.

Why XSLT Is Important.

XSLT Overview.

A Simple Example: Hello World.

Another Simple Example: Changing Tag Names.

A General Approach to Using XSLT.

XPath Basics.

Structuring Stylesheets.

A Bit of Housekeeping.

The xsl:output Element.

Running Transformations from a Command Line.

Manipulating Content.

Adding and Removing Content.

Splitting Data Content.

Combining Data Content.

Changing an Attribute to an Element.

Changing an Element to an Attribute.

Solving Typical Navigation Problems.

Mapping a Flat Structure to a Hierarchy.

Mapping a Hierarchy to a Flat Structure.

Tips for Dealing with Other Navigation Problems.

Advanced Techniques for Processing Content.

Omitting Empty Elements and Attributes.

Converting Coded Values.

Handling Calculations.

Handling Namespaces.

Calling Non-XSLT Procedures.

References.

Resources.



11. Using the Conversion Techniques Together.

Pipe and Filter Revisited.

Sample Conversion Scenarios and Scripts.

Purchase Order: UBL to XML to CSV.

Invoice: Flat File to XML to EDI.

Campaign Contribution Reporting: CSV to XML to Flat File.

Building a System: Babel Blaster.

Version 1.0 Requirements.

Architectural Overview.

Trading Partner/Application Information.

Linking Pipes and Filters.

Version 1.1 Requirements.

Resources.



12. Building XML Support into a Business Application.

What Should Be XMLized?

Devising an Architecture.

Selecting the XML Format.

Changing Your Code.

What about Databases?

Other Approaches and APIs.

Non-XML Issues.

Resources.



13. Security, Transport, Packaging, and Other Issues.

Some General Observations about Security.

Dealing with Security.

Security Requirements and Exposure.

Countermeasures and Remediation Strategies.

Prevention Countermeasures.

Transport.

Packaging.

Common Combinations for Security, Transport, and Packaging.

Emerging Technologies.

What This Means for You.

Reference.



Appendix A. GNU General Public License.


Appendix B. Pseudocode Conventions.


Appendix C. COM Essentials for the Non-COM Programmer.


Bibliography.


Credits.


Index.

Preface

Some day most business applications will be able to read and write XML files. Until that happens, you are probably going to need techniques and utilities like those presented in this book. This book is for people who use business applications that don't currently support XML, and for people who develop those applications and want to build XML support into them. It is designed to provide a tool kit of techniques and utilities that can help you to perform common EAI, B2B, and EDI data conversion operations using XML.

Nothing in this book is rocket science. Any good programmer with experience in the relevant technologies could develop any of these techniques and utilities. The point of this book is that I've done it so that you don't have to. As is often said, good programmers develop good programs. Better programmers steal what they can and modify it. Steal this code.

If you are a user of a business application and already have or can afford to procure a capable EAI or EDI software package, you probably don't need this book. However, if you only have some simple needs that don't justify the purchase of such a package, or if for some other reason you don't want to or can't afford to spend thousands of dollars to purchase one, then this book is for you. In addition, if you are interested in an open, nonproprietary, standards based, and portable approach to data conversion, then this book is for you, too.



0321154940P04212003

Index

Download the Index file related to this title.

Updates

Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership