Skip to Content
Programming PHP, 4th Edition
book

Programming PHP, 4th Edition

by Kevin Tatroe, Peter MacIntyre
March 2020
Intermediate to advanced
542 pages
12h 22m
English
O'Reilly Media, Inc.
Book available
Content preview from Programming PHP, 4th Edition

Chapter 12. XML

XML, the Extensible Markup Language, is a standardized data format. It looks a little like HTML, with tags (<example>like this</example>) and entities (&amp;). Unlike HTML, however, XML is designed to be easy to programmatically parse, and there are rules for what you can and cannot do in an XML document. XML is now the standard data format in fields as diverse as publishing, engineering, and medicine. It’s used for remote procedure calls, databases, purchase orders, and much more.

There are many scenarios where you might want to use XML. Because it is a common format for data transfer, other programs can emit XML files for you to either extract information from (parse) or display in HTML (transform). This chapter shows you how to use the XML parser bundled with PHP, as well as how to use the optional XSLT extension to transform XML. We also briefly cover generating XML.

Recently, XML has been used in remote procedure calls (XML-RPC). A client encodes a function name and parameter values in XML and sends them via HTTP to a server. The server decodes the function name and values, decides what to do, and returns a response value encoded in XML. XML-RPC has proved a useful way to integrate application components written in different languages. We’ll show you how to write XML-RPC servers and clients in Chapter 16, but for now let’s look at the basics of XML.

Lightning Guide to XML

Most XML consists of elements (like HTML tags), entities, and regular data. For example: ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Java, 5th Edition

Learning Java, 5th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck
PHP 8 Basics: For Programming and Web Development

PHP 8 Basics: For Programming and Web Development

Gunnard Engebreth, Satej Kumar Sahu
Programming C# 8.0

Programming C# 8.0

Ian Griffiths

Publisher Resources

ISBN: 9781492054122Errata PageSupplemental Content