25.09.2014 Views

ZEND PHP 5 Certification STUDY GUIDE

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

188 ” XML and Web Services<br />

structure of a document, which may not even be a requirement for your particular<br />

needs. However, all XML documents must be well-formed for <strong>PHP</strong>’s XML functionality<br />

to properly parse them, as XML itself is a strict language.<br />

Creating an XML Document<br />

Unless you are working with a DTD or XML Schema Definition (XSD), which provides<br />

an alternate method to describe a document, creating XML is a free-form process,<br />

without any rigid constraints except those that define a well-formed document. The<br />

names of tags, attributes, and the order in which they appear are all up to the creator<br />

of the XML document.<br />

First and foremost, XML is a language that provides the means for describing data.<br />

Each tag and attribute should consist of a descriptive name for the data contained<br />

within it. For example, in XHTML, the tag is used to describe paragraph data,<br />

while the tag describes table data and the tag describes data that is to be<br />

emphasized. In the early days of HTML and text-based Web browsers, HTML tags<br />

were intended merely to describe data, but, as Web browsers became more sophisticated,<br />

HTML was used more for layout and display than as a markup language. For<br />

this reason, HTML was reformulated as an application of XML in the form of XHTML.<br />

While many continue to use XHTML as a layout language, its main purpose is to describe<br />

types of data. Cascading style sheets (CSS) are now the preferred method for<br />

defining the layout of XHTML documents.<br />

Since the purpose of XML is to describe data, it lends itself well to the transportation<br />

of data between disparate systems. There is no need for any of the systems<br />

that are parties to a data exchange to share the same software packages, or encoding<br />

mechanisms, or byte order. As long as both systems know how to read and parse<br />

XML, they can talk. To understand how to create an XML document, we will be discussing<br />

one such system that stores information about books. For the data, we have<br />

plucked five random books from our bookshelf. Here they are:<br />

Licensed to 482634 - Amber Barrow (itsadmin@deakin.edu.au)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!