We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, such as a spelling mistake or faulty piece of code, we would be very grateful if you'd tell us about it. By sending in errata, you may spare another reader hours of frustration; at the same time, you are helping us provide even
To find the errata page for this book, go to http://www.wrox.com and locate the title using the Search box or one of the title lists. Then, on the book details page, click the Book Errata link. On this page, you can view all errata that have been submitted for this book and posted by Wrox editors. A complete book list including links to each book's errata is also available at http://www.wrox.com/misc-pages/booklist.shtml.
If you don't spot "your" error already on the Book Errata page, go to http://www.wrox.com/contact/techsupport.shtml and complete the form there to send us the error you have found. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in
For author and peer discussion, join the P2P forums at http://www.p2p.wrox.com. The forums are a Web-based system for you to post messages relating to Wrox books and technologies and to interact with other readers and technology users. The forums offer a subscription feature that enables you to receive e-mail on topics of interest when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are represented in these forums.
At http://www.p2p.wrox.com you will find a number of different forums that will help you not only as you read this book but also as you develop your own applications. To join the forums, just follow these steps:
Go to http://www.p2p.wrox.com and click the Register link.
Read the terms of use and click Agree.
Supply the information required to join, as well as any optional information you want to provide, and click Submit.
You will receive an e-mail with information describing how to verify your account and complete the joining process.
| Note |
You can read messages in the forums without joining P2P, but you must join in order to post messages. |
After you join, you can post new messages and respond to other users' posts. You can read messages at any time on the Web. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to this Forum icon by the forum
For more information about how the forum software works, as well as answers to many common questions specific to P2P and Wrox books, be sure to read the P2P FAQs. Simply click the FAQ link on any P2P page.
Extensible Markup Language
(XML) is now in widespread use. Many applications on the Internet or residing on individual computers use some form of XML to run or manage the processes of an application. Earlier books about XML commented that XML was to be the "
For this reason, you want to understand XML and its various applications. This book focuses on some of the more common ways to apply XML to the work you are doing today. Whether you need Web services, searching, or application configuration, you can find immediate uses for XML. This book shows you how to apply this markup language to your work.
This first chapter looks at the basics of XML, why it exists, and what makes it so powerful. Finally, this chapter deals with XML namespaces and how to properly apply them to XML instance documents. If you are already pretty familiar with the basics of XML, feel free to skim this chapter before proceeding.
Before you actually get into the basics of XML, you should understand why this markup language is one of the most talked about things in computing today. To do this, look back in time a bit.
During the days of mainframes, information technology might have seemed complicated, but it actually got a heck of a lot more complicated when we moved from the mainframes and started working in a client-server model. Now the users were accessing information remotely instead of sitting at the same machine where the data and logic were actually stored. This caused all sorts of problems-
Two problems had to be resolved. One dealt with computer-to-human communications of data and logic; another dealt with application-to-application communications. This is
Figure 1-1
The first problem of computer-to-human communication of data and logic was really
With that said, it really isn't all about
It was a tough task. The varying sources of data were often not compatible with the platform where the data was to be
The idea was to
mark up
a document in a manner that enabled the document to be
For instance, Microsoft Word provides markup around the contents of document. What markup is really needed? Well, as you type words into Microsoft Word, you are also providing data to be housed in the document. The reason you don't simply use Microsoft Notepad is that Word gives you the extra capability to change the way in which the data is represented. What this really means is that you can apply
metadata
around the data points contained in the document. For instance, you can specify whether a word, paragraph, or page is bolded, italicized, or
Like Word, XML uses markup to provide metadata around data points contained within the document to further define the data element. XML provides such an easy means of creating and presenting markup that it has become the most popular way to apply metadata to data.
In its short lifetime, XML has become the standard for data representation. XML came into its own when the W3C ( The World Wide Web Consortium ) realized that it needed a markup language to represent data that could be used and consumed regardless of the platform. When XML was created in 1998, it was quickly hailed as the solution for data transfer and data representation across varying systems.
In the past, one way to represent data was to place the data within a comma-, tab-, or pipe-delimited text file. Listing 1-1 shows an example of this:
Listing 1-1: An example of a pipe-delimited data representation
|
|
BillEvjenTechnical ArchitectLipper10/04/2001St. Louis, Missouri3
|
|
These kinds of data representations are in use today. The individual pieces of data are separated by pipes, commas, tabs, or any other
On the other hand, XML
Listing 1-2: Representing the data in an XML document
|
|
<?xml version="1.0" encoding="UTF-8" ?> <Employee> <FirstName>Bill</FirstName> <LastName>Evjen</LastName> <JobTitle>Technical Architect</JobTitle> <Company>Lipper</Company> <StartDate>10/04/2001</StartDate> <WorkLocation>St. Louis, Missouri</WorkLocation> <NumberOfDependents>3</NumberOfDependents> </Employee>
|
|
You can now tell, by just looking at the data in the file, what the data items mean and how they relate to one another. The data is laid out in such a simple format that is quite possible for even a non-technical person to understand the data. You can also have a computer process work with the data in an automatic fashion.
When you look at this XML file, you may notice how similar XML is to HTML. Both markup languages are
Both XML and HTML have their roots in the Standard Generalized Markup Language (SGML), which was created in 1986. SGML is a complex markup language that was also used for data representation. With the explosion of the Internet, however, the W3C realized that it needed a universal way to represent data that would be easier to use than SGML. That realization brought forth XML.
XML has a distinct advantage over other forms of data representation. The following list represents some of the reasons XML has become as popular as it is today:
q XML is easy to understand and read.
q A large number of platforms support XML and are able to manage it through an even larger set of tools available for XML data reading, writing, and manipulation.
q
XML can be used across
q XML allows developers to create their own data definitions and models of representation.
q Because a large number of XML tools are available, XML is simpler to use than binary formats when you want to represent complex data structures.