Home arrow PHP arrow Loading XML Strings with simpleXML in PHP 5

Loading XML Strings with simpleXML in PHP 5

Are you looking forward to learning about loading XML data strings, as well as searching and accessing nodes? Then this is the tutorial you’ve been waiting for since last week! Welcome to the second part of the series “Working with simpleXML in PHP 5.” This three-part series introduces the most important features of the “simpleXML” extension that comes with PHP 5, and shows by several hands-on examples how to implement the handy set of XML-parsing functions that are included in this library.

TABLE OF CONTENTS:
  1. Loading XML Strings with simpleXML in PHP 5
  2. Parsing basic XML strings: using the "simplexml_load_string()" function
  3. More examples with the "simplexml_load_string()" function: accessing parent and child nodes
  4. Parsing XML strings by an object-oriented approach: building a PHP 5 XML parsing class
By: Alejandro Gervasio
Rating: starstarstarstarstar / 9
June 19, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

For those of you who didn't read the first article, let me put you quickly in the right context. Over the course of the previous tutorial, I explained the basics of the excellent "simpleXML" library included with PHP 5, introducing the use of the "simplexml_load_file()" function. This can be remarkably useful if you need to add basic XML parsing capabilities to your PHP 5 applications, but don't wish to develop a full-blown XML parser.

Based on the capacity provided by the "simplexml_load_file()" function, I went through the development of different practical examples, aimed at illustrating how a specific XML file can be basically parsed in different ways, including the loading of XML data onto objects, as well as the localization (and eventually the extraction) of particular nodes within a file. In addition, due to the ubiquitous nature of this extension, I showed how to build a basic XML parsing class, which worked as a simple wrapper for the "simplexml_load_file()" function, allowing the retrieval of different nodes contained within an XML file, and more.

Hopefully, all the examples shown in the previous article have provided you with the right pointers to start using the "simpleXML" library with only minor hassles, therefore in this second tutorial, I'll continue exploring other helpful functions, focused primarily on loading XML data strings, as well as searching and accessing nodes.

Provided that all the topics that I mentioned before already caught your attention, let's continue exploring the handy functions included within the "simpleXML" extension. Let's get started!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: