05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Chapter CHAPTER 11 11<br />

XML<br />

XML, the Extensible Markup Language, is a standardized data format. It looks a little<br />

like HTML, with tags (like this) and entities (&amp;). Unlike<br />

HTML, however, XML is designed to be easy to parse, and there are rules for what<br />

you can and cannot do in an XML document. XML is now the standard data format<br />

in fields as diverse as publishing, engineering, and medicine. It’s used for remote procedure<br />

calls, databases, purchase orders, and much more.<br />

There are many scenarios where you might want to use XML. Because it is a common<br />

format for data transfer, other programs can emit XML files for you to either<br />

extract information from (parse) or display in HTML (transform). This chapter<br />

shows how to use the XML parser bundled with <strong>PHP</strong>, as well as how to use the<br />

optional XSLT extension to transform XML. We also briefly cover generating XML.<br />

Recently, XML has been used in remote procedure calls. A client encodes a function<br />

name and parameter values in XML and sends them via HTTP to a server. The server<br />

decodes the function name and values, decides what to do, and returns a response<br />

value encoded in XML. XML-RPC has proved a useful way to integrate application<br />

components written in different languages. In this chapter, we’ll show you how to<br />

write XML-RPC servers and clients.<br />

Lightning Guide to XML<br />

Most XML consists of elements (like HTML tags), entities, and regular data. For<br />

example:<br />

262<br />

<br />

<strong>Programming</strong> <strong>PHP</strong><br />

<br />

Rasmus Lerdorf<br />

Kevin Tatroe<br />

<br />

<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.

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

Saved successfully!

Ooh no, something went wrong!