HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
"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:
For developers working with either MSXML with Visual C++ or Java and Xerces:
For end users who need a simple and robust conversion utility:
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.
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.
XML-Enabling a Legacy Application
XSLT Transformations from Java and C++ with the DOM
Click for the Author's Web Site related to this title.
Opening the Door to Open Source
Download the Sample Chapter related to this title.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Download the Index
file related to this title.