PHP
  Home arrow PHP arrow Introducing SimpleXML in PHP 5
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
SunQuest
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Introducing SimpleXML in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 28
    2006-06-12

    Table of Contents:
  • Introducing SimpleXML in PHP 5
  • Reading XML files with the “simplexml_load_file()” function
  • Accessing file nodes as array elements
  • Creating a basic XML parsing class

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    At the virtual BlackBerry Technical Seminar 2008, you can ask your development questions directly of Research In Motion® (RIM) experts, and take advantage of learning opportunities designed uniquely for BlackBerry solution developers. Register Today!

    Introducing SimpleXML in PHP 5


    (Page 1 of 4 )

    In the first article of a three-part series, you will learn the basics of using the “simplexml” extension that comes with PHP 5. This library is primarily focused on parsing simple XML files, and can save you a lot of work.

    Introduction

    For those of you who have been using PHP 5 for a while, the numerous improvements introduced into the Zend engine have brought significant advantages that help to accelerate the development of Web applications. Intermediate and experienced developers probably will tell you nice things about the new object model, and the implementation of exceptions, in addition to the set of functions aimed at processing XML data in different ways. And of course, the list of new features goes on and on.

    However, recently I discovered a little jewel hidden behind the tons of big improvements that come with PHP 5: a small and powerful library called “simpleXML.” Indeed, if you’re currently working on a project that requires handling XML data in a basic manner, this extension might eventually suit your needs, without your having to develop a full-featured XML parser.

    Definitely, one of the best things about “simpleXML” is how easily it performs  basic tasks, such as reading XML files, extracting data from XML strings, comparing and replacing nodes, and so forth. Based on this simplicity, you can develop a decent XML parsing application without having to make a huge effort, or even combine all these cool features with the functionality of AJAX, in order to construct a full-fledged application that uses the best of client and server-based scripting languages.

    In response to all the exciting features that I mentioned before, in this three-part series I’ll be taking a close look at the most important functions of the “simpleXML” extension, using numerous code samples and clear explanations to put them in context, so you can understand how they work.

    At the end of the series, you should be equipped with the proper background to start using “simpleXML” in your own PHP 5 applications.

    Having now defined the goals of this series, let’s find out together how to use the “simpleXML” library with PHP 5. Let’s get going!

    More PHP Articles
    More By Alejandro Gervasio


       · In the course of this first article, you'll learn how to use some of the most...
       · I enjoyed your article. All the xml files you used were stored on the server, is...
       · Hello JET:I'm happy to know you enjoyed my article. Thank you. Now, in response...
       · Nice article, I only found an mistake during the countNodes function.The $nodeName...
       · I'm glad to know that the article has been useful to you. Now, with reference to...
       · Hi,this solution doesn't work for me.if I remove an 'address' element from...
       · Hello Bob,Thank you for your comments. I tested the method and works just fine....
       · Hi,thank you for your answer.Tested it again and still get the same output...
       · Hi Bob,Thank you for your feedback. Okay, there was a small bug on the method....
       · Hi,thank you for your answer.In the meantime I also found a working...
       · Hi Bob,I'm glad to see you found an alternative solution to the one I provided...
     

       

    PHP ARTICLES

    - Viewing and Editing Tasks for a Project Mana...
    - More on Private Methods with PHP 5 Member Vi...
    - Adding Tasks to a Project Management Applica...
    - Utilizing Private Methods with PHP 5 and Mem...
    - Making Changes in a Project Management Appli...
    - Defining Public and Protected Methods with M...
    - HTML for a Project Management Application
    - Using Subclasses and Accessors with Member V...
    - Implementing Internet Protocols with PHP
    - Project Management: The Application
    - Working with Private Properties to Protect P...
    - Protecting PHP 5 Class Data with Member Visi...
    - Setting Up a Web-based Image Hosting Service
    - Comparing Files and Databases with PHP Bench...
    - Setting Up a Web-Based Image Gallery

    Click Here




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway