-
Book Overview & Buying
-
Table Of Contents
PHP jQuery Cookbook
By :
True to its name, SimpleXML functions provide an easy way to access data from XML documents. XML files or strings can be converted into objects, and data can be read from them.
We will see how to load an XML from a file or string using SimpleXML functions. You will also learn how to handle errors in XML documents.
Create a new directory named Chapter3. This chapter will contain sub-folders for each recipe. So, create a folder named Recipe1 inside it.
Create a file named index.php in Recipe1 folder. In this file, write the PHP code that will try to load the common.xml file. On loading it successfully, it will display a list of book names. We have also used the libxml functions that will detect any error and will show its detailed description on the screen.
<?php
libxml_use_internal_errors(true);
$objXML = simplexml_load_file('../common.xml');
if (!$objXML)
{
$errors = libxml_get_errors();
foreach($errors...
Change the font size
Change margin width
Change background colour