ISBN-10:
0201748525
ISBN-13:
9780201748529
Pub. Date:
12/10/2001
Publisher:
Addison-Wesley
XML-the Microsoft Way

XML-the Microsoft Way

by Peter G. Aitken

Paperback

Current price is , Original price is $39.99. You
Select a Purchase Option
  • purchase options

Product Details

ISBN-13: 9780201748529
Publisher: Addison-Wesley
Publication date: 12/10/2001
Pages: 560
Product dimensions: 7.32(w) x 9.16(h) x 1.03(d)

Read an Excerpt

Introduction

Extensible Markup Language (XML) is quite simple in concept. It is nothing more than a set of rules for providing structure to data. Despite this underlying simplicity--or perhaps partly because of it--XML has become an extremely important technology that is widely used in diverse areas of information processing. Because XML can be used with essentially any kind of data, it has found application in areas as dissimilar as finance, agriculture, law, medicine, and computer programming. Because XML is a public, nonproprietary standard, it can be used by anyone, anywhere. Because XML is platform independent, it is used on Windows PCs, Macintoshes, Linux boxes, mainframes, and just about any other platform you care to mention. What's more, XML permits these various types of computers to exchange data with an ease that was never possible before. More and more applications developers find themselves needing to write XML applications. Given that you are reading this, I suspect you are one of them.

About This Book

This book is intended for software developers who need to learn the fundamentals of XML and its most important related technologies, and who also want to learn how to include XML support in their applications. It is specifically aimed at developers who create applications for the Windows platform using Microsoft development tools. About half of the book's chapters deal with public XML and related standards and would be useful to any XML developer regardless of the platform or development tools being used (although coding examples make use of Microsoft languages). The remaining chapters deal specifically with using XML with Microsoft development andend-user tools: Visual Basic, Visual C++, Internet Explorer, Active Server Pages, the .NET Framework, and so on.

Readers are assumed to have little or no experience with XML and its related technologies. The XML material is presented "from the ground up" and is suitable for XML beginners as well as those with an intermediate level of knowledge. The programming chapters, on the other hand, assume some prior experience with the specific language or technology in use. For example, Chapter 15 shows you how to manipulate XML from a Visual Basic program, but it does not teach you the fundamentals of using Visual Basic. Chapters on Visual C++ and the new .NET language C# are included as well.

What about Java?

For many XML programmers, Java is the language of choice. There are many good reasons for this preference, not the least of which is the availability of many powerful Java tools for use with XML. However, you'll see that there is no coverage of Java in this book. This is because the book is designed specifically to cover Microsoft tools as they relate to XML, and Microsoft's Java, known as Visual J++, has reached a dead end. As a result of legal settlements, Microsoft has agreed to stop upgrading Visual J++, so the current version of this product (Visual J++ version 6.0) will be the last. Thus, there is no place for Java in a Microsoft-oriented book--much to my dismay, as it is an excellent language.

Yet all is not lost for the Java lover working in a Microsoft shop. The latest Microsoft development tools, collectively known as Visual Studio .NET, include a new language called C# (C sharp). While Microsoft officially denies it, many people see C# as Microsoft's replacement for Java. C# is Java-like in many ways, and I think that any Java programmer will soon feel at home with C#.

About the Listings

Throughout the book, code samples are presented both as code fragments interspersed in the text and as separate numbered listings. For the most part, the numbered listings are complete files--for example, a complete XML file or a complete Visual Basic source code file. In a few cases, a listing is a fragment of a file, such as a section of source code that cannot function on its own but must be part of a larger program. These exceptions are clearly noted.

Source Code and Corrections

You can download all of the code (from the numbered listings) from the book's companion Web page. The download file is a ZIP archive. When you expand the ZIP file, you will have a separate folder for each of the book's chapters (except those that do not have any listings). This Web page also lists any corrections that have been reported. If you find what you think is an error in the book, please let me know by e-mailing me at peter@pgacon.com. I am also delighted to hear from readers with any comments or suggestions regarding the book. Please note, however, that I can respond only to queries that are directly book-related, and I cannot answer any general programming questions you may have.

Peter G. Aitken
Chapel Hill, North Carolina
August 2001



Table of Contents

Introductionxvii
About This Bookxvii
What about Java?xviii
About the Listingsxviii
Source Code and Correctionsxix
Acknowledgmentsxxi
Chapter 1XML: What and Why?1
What Is XML?1
The Development of XML4
Optional XML Technologies6
XLink and XPointer8
The XML Standards Process10
Tools for Working with XML14
Summary17
Chapter 2The Syntax of XML19
Syntax Overview19
Processing Instructions22
Physical and Logical Structure of an XML Document23
Entities24
Elements30
Attributes32
Declaring Notations33
Character Data34
Comments35
White Space Issues36
Summary39
Chapter 3Data Modeling with DTDs41
Importance of Data Modeling41
Document Type Definitions43
The Document Type Declaration44
Stand-alone Documents44
Declaring Elements44
Declaring Attributes48
Parameter Entities55
Conditional Sections56
A DTD Demonstration57
Summary59
Chapter 4Data Modeling with XDR Schemas61
XML Schema61
Namespace Fundamentals63
The XDR Vocabulary66
Connecting a Document to a Schema79
Validating Documents against Schemas80
An XDR Schema Demonstration80
DTD or XML Schema: Which to Use?83
Summary85
Chapter 5Data Modeling with XSD Schemas87
XSD Schema Overview87
XSD Data Types88
The schema Element107
Connecting a Schema to an XML File107
An XSD Schema Demonstration108
Summary111
Chapter 6Formatting XML Documents with Cascading Style Sheets113
Style Sheet Fundamentals113
CSS Basics114
Creating and Referencing Style Sheets126
A CSS Demonstration126
Summary133
Chapter 7Extensible Stylesheet Language and XSLT135
XSL Fundamentals135
Style Sheet Structure140
XSLT Templates144
XPath Patterns152
XPath Expressions154
Functions161
Summary174
Chapter 8Formatting Objects175
FO Basics175
The FO Model177
FO Document Structure178
Content Elements183
FO Attributes194
An XSLT-FO Demonstration203
Summary208
Chapter 9XLink and XPointer209
XLink209
XPointer217
Summary223
Chapter 10Using the Document Object Model225
DOM Overview and Background225
The DOMDocument Object229
The DOM Object Model235
Navigating the Document Tree236
Reading Element and Attribute Data240
Modifying Document Data and Structure247
DOM and XSLT254
Summary255
Chapter 11The Simple API for XML Interface257
SAX Overview and Background257
The SAX Interface260
SAX and Visual C++271
Summary271
Chapter 12The Simplified Object Access Protocol273
Web Services273
SOAP Basics275
SOAP and Microsoft277
SOAP Requests277
Web Services Description Language and Web Services Meta Language280
The Microsoft SOAP Toolkit280
Summary290
Chapter 13XML and the .NET Framework291
.NET Overview291
The System.XML Assembly292
The XmlTextReader Class292
The XmlValidatingReader Class299
The XmlTextWriter Class303
The XmlDocument Class309
Summary322
Chapter 14Extensible Hypertext Markup Language and Web Pages323
Some HTML Background323
XML to the Rescue324
Structure of an XHTML Document326
XHTML Elements331
Summary350
Chapter 15Visual Basic and XML351
Verifying Well-Formedness and Validity of an XML Document: DTD and XDR351
Verifying Well-Formedness and Validity of an XML Document: XSD356
Processing Raw XML359
Using SAX to Extract XML Data373
Using DOM to Modify Document Structure382
Summary387
Chapter 16Visual C++ and XML389
Outline of the Samples in This Chapter390
Following the Search393
Maintaining the XML Database405
Summary417
Chapter 17Internet Explorer: Client-Side Scripting and Dynamic HTML419
Scripting419
Dynamic HTML420
Client-Side Scripting and Data Islands423
The Data Source Object432
Summary438
Chapter 18Server-Side Scripting and XML439
ASP Fundamentals439
ASP Demonstration Programs450
Summary463
Chapter 19The BizTalk Framework465
BizTalk Background465
BizTalk Standards467
The BizTalk Document468
Summary474
Chapter 20Microsoft Office and XML475
Programming in VBA475
Excel478
Word487
Access490
FrontPage494
Summary495
Appendix AXDR Schema Data Types497
Bibliography501
Index503

Preface

Extensible Markup Language, or XML, is quite simple in concept. It is nothing more than a set of rules for providing structure to data. Despite this underlying simplicity�-or perhaps partly because of it-�XML has become an extremely important technology that is widely used in diverse areas of information processing. Because XML can be used with essentially any kind of data, is has found application in areas as dissimilar as finance, agriculture, law, medicine, and computer programming. Because XML is a public, non-proprietary standard it can be used by anyone, anywhere. Because XML is platform-independent, it is used on Windows PC's, Macintoshes, Linux boxes, mainframes, and just about any other platform you care to mention. What's more, XML permits these various types of computers to exchange data with an ease that was never possible before. More and more applications developers find themselves needing to write XML applications. Given that you are reading this, I suspect you are one of them.

About This Book

This book is intended for software developers who need to learn the fundamentals of XML and its most important related technologies, and who also want to learn how to include XML support in their applications. It is specifically aimed at developers who create applications for the Windows platform using Microsoft development tools. About half of the book's chapters deal with public XML and related standards and would be useful to anyXML developer regardless of the platform or development tools being used (although coding examples make use of Microsoft languages). The remaining chapters deal specifically with using XML with Microsoft development and end-user tools: Visual Basic, Visual C++, Internet Explorer, Active Server Pages, the .Net Framework, and so on.

Readers are assumed to have little or no experience with XML and its related technologies. The XML material is presented "from the ground up" and will be suitable for XML beginners as well as those with an intermediate level of knowledge. The programming chapters, on the other hand, assume some prior experience with the specific language or technology in use. For example, Chapter 15 shows you how to manipulate XML from a Visual Basic program, but it does not teach you the fundamentals of using Visual Basic. Chapters on Visual C++ and the new .Net language C# are included as well.

What About Java?

For many XML programmers, Java is the language of choice. There are many good reasons for this preference, not the least of which is the availability of many powerful Java tools for use with XML. However, you'll see that there is no coverage of Java in this book. This is because the book is designed specifically to cover Microsoft tools as they relate to XML, and Microsoft's Java, known as Visual J++, has reached a dead end. As a result of legal settlements, Microsoft has agreed to stop upgrading Visual J++, so the current version of this product (Visual J++ version 6) will be the last. Thus, there is no place for Java in a Microsoft-oriented book�much to my dismay, as it is an excellent language.

Yet all is not lost for the Java lover working in a Microsoft shop. The latest Microsoft development tools, collectively known as Visual Studio.Net, include a new language called C# (C sharp). While Microsoft officially denies it, many people see C# as Microsoft's replacement for Java. C# is very Java-like in many ways, and I think that any Java programmer will soon feel at home with C#.

About the Listings

Throughout the book, code samples are presented both as code fragments interspersed in the text, and as separate numbered listings. For the most part, the numbered listings are complete files�for example, a complete XML file or a complete Visual Basic source code file. In a few cases, a listing will be a fragment of a file, such as section of source code that cannot function on its own but must be part of a larger program. These exceptions are clearly noted.

Source Code and Corrections

You can download all of the code (from the numbered listings) from the book's Web page (forthcoming). The download file is a ZIP archive. When you expand the ZIP file you will have a separate folder for each of the book's chapters (excepting those that do not have any listings). This Web page will also list any corrections that have been reported.

—Peter G. Aitken

Chapel Hill, North Carolina

August 2001



Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews