Skip to Main Content
XML and PHP
book

XML and PHP

by Vikram Vaswani
June 2002
Intermediate to advanced content levelIntermediate to advanced
384 pages
7h 53m
English
Sams
Content preview from XML and PHP

A Few Examples

Now that you know the theory, let’s see how it works in some real-life examples. The following sections illustrate how PHP’s SAX parser can be used to “do something useful” with XML data.

Formatting an XML Invoice for Display in a Web Browser

Consider the XML document in Listing 2.21, which contains an invoice for material delivered by Sammy’s Sports Store.

Listing 2.21. XML Invoice (invoice.xml)
 <?xml version="1.0"?> <!DOCTYPE invoice [ <!ENTITY message "Thank you for your purchases!"> <!ENTITY terms SYSTEM "terms.xml"> ]> <invoice> <customer> <name>Joe Wannabe</name> <address> <line>23, Great Bridge Road</line> <line>Bombay, MH</line> <line>India</line> </address> </customer> <date>2001-09-15</date> <reference>75-848478-98</reference> ...
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

PHP Development Tool Essentials

PHP Development Tool Essentials

Chad Russell
PHP Web Services

PHP Web Services

Lorna Jane Mitchell

Publisher Resources

ISBN: 0735712271Purchase book