Simpo PDF Merge and Split Unregistered Version -
Simpo PDF Merge and Split Unregistered Version -
ffirs.indd iv
05/06/12 9:53 PM
Simpo PDF Merge and Split Unregistered Version -
BEGINNING XML
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxvii
PART I
INTRODUCING XML
CHAPTER 1
What Is XML?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
CHAPTER 2
Well-Formed XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
CHAPTER 3
XML Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
PART II
VALIDATION
CHAPTER 4
Document Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
CHAPTER 5
XML Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
CHAPTER 6
RELAX NG and Schematron. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
PART III
PROCESSING
CHAPTER 7
Extracting Data from XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
CHAPTER 8
XSLT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
PART IV DATABASES
CHAPTER 9
XQuery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
CHAPTER 10
XML and Databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
PART V
PROGRAMMING
CHAPTER 11
Event-Driven Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
CHAPTER 12
LINQ to XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
PART VI COMMUNICATION
ffirs.indd i
CHAPTER 13
RSS, Atom, and Content Syndication . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
CHAPTER 14
Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
CHAPTER 15
SOAP and WSDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
CHAPTER 16
AJAX. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
05/06/12 9:53 PM
Simpo PDF Merge and Split Unregistered Version -
PART VII DISPLAY
CHAPTER 17
XHTML and HTML 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
CHAPTER 18
Scalable Vector Graphics (SVG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
PART VIII CASE STUDY
CHAPTER 19
Case Study: XML in Publishing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727
APPENDIX A Answers to Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
APPENDIX B
XPath Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
APPENDIX C XML Schema Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
ffirs.indd ii
05/06/12 9:53 PM
Simpo PDF Merge and Split Unregistered Version -
BEGINNING
XML
ffirs.indd iii
05/06/12 9:53 PM
Simpo PDF Merge and Split Unregistered Version -
Summary
❘ 399
SUMMARY
In this chapter you’ve learned about the following:
➤
Much of today’s data comes in the form of tabular data and XML combined.
➤
You need a dedicated storage type for XML rather than just use a text field. You also need
methods to extract specific values and fragments of XML as well as methods to create new
XML formats combining the relational and XML data. You will probably want the facility
to update XML documents although this is not always a necessity.
➤
A relational database handles both tabular data and XML documents, whereas a native
XML database is designed to cope solely with XML documents.
➤
High-end systems such as Oracle and SQL Server XML have their own data type and there
are suitable methods available on these types for retrieval and manipulation of the XML.
➤
The features available in a native XML database include the ability to store large document
collections as well as the ability to efficiently query across these documents.
EXERCISES
You can fi nd suggested answers to these questions in Appendix A.
c10.indd 399
1.
List the main reasons to choose a relational database with XML features over a native XML
database.
2.
What five methods are available against an XML data type? (No peeking!)
3.
MySQL has only two XML-related functions. If you could ask for one more feature or function,
what would it be?
05/06/12 5:37 PM
Simpo PDF Merge and Split Unregistered Version -
400
❘
CHAPTER 10
XML AND DATABASES
WHAT YOU LEARNED IN THIS CHAPTER
c10.indd 400
TOPIC
KEY POINTS
Storage needs
There is a big difference between relational data, data in a tabular format, and XML data. Therefore, special mechanisms are needed to store
XML within relational systems.
Essential features in
databases.
XML needs to be stored in a native format, rather than as text. There
must also be ways to query it for specific values and a way to return fragments of XML. Ideally there should also be a way to treat XML as tabular
data if possible.
Choosing an
application
Most commercial relational databases have fairly advanced XML features, particularly Oracle and SQL Server. Native XML databases are
designed to cope with the situation in which all data is held as XML.
05/06/12 5:37 PM