Join David Powers for an in-depth discussion in this video Using the exercise files, part of Learning PHP SimpleXML.
- If you're a subscriber to the lynda.com online training library you have access to the exercise files for this course. Just download them from the link on the courses page and unzip them to a convenient location. I've got them here on my desktop. So let's take a quick look. All the files are in folders corresponding to each chapter, and inside each chapter folder are seperate folders for each video that uses exercise files. The folders for each video contain all the files that you need, apart from the XML data source files.
They're in a separate folder called XML, which we'll look at in a moment. In most cases, the folder for an individual video contains two versions of each file. One for the script at the beginning of the video and the one with end appended to the filename is what it looks like at the end. So let's take a quick look at the XML folder. This contains all the data source files that are used throughout the course, however there's one important XML file that isn't included here.
It's called bbc_tech.xml. And that's used throughout Chapter 4. You'll need to create this file yourself using a script that's provided in Chapter 4. So if we go to Chapter 4 and then in the 04_01 folder, here's that script that will create that file for you. This will generate an up to date version of an RSS feed about technology from BBC news that's used right throughout Chapter 4.
Because we're working with PHP, you'll need to copy the exercise files into your server route. If you keep all the files in the same folder structure as they are here, the relative paths to the XML source files will work correctly. So that's how the exercise files are organized. Let's get up and running with PHP SimpleXML.
- Loading an XML document
- Converting values to strings
- Handling errors
- Working with XML namespaces
- Using XPath
- Consuming an RSS feed with XML
- Adding and editing XML elements and attributes