PHP
  Home arrow PHP arrow Loading XML Strings with simpleXML in ...
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 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 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

Loading XML Strings with simpleXML in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2006-06-19

    Table of Contents:
  • Loading XML Strings with simpleXML in PHP 5
  • Parsing basic XML strings: using the "simplexml_load_string()" function
  • More examples with the "simplexml_load_string()" function: accessing parent and child nodes
  • Parsing XML strings by an object-oriented approach: building a PHP 5 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


    Loading XML Strings with simpleXML in PHP 5


    (Page 1 of 4 )

    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.

    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


       · Over the course of this tutorial, some of the most important methods that come with...
       · I tried to use this new function of PHP5, but I encountered some problems with...
       · Thank you for your comments about this article. Now, regarding your question, I've...
       · I will give you my results as soon as possible.My Medion computer failed and is in...
       · Hello friend,I'm glad to know that my suggestions are useful to you. I hope your...
       · I use the following to convert all of the xml file to UTF-8 before using the...
       · Thank you for the useful function you wrote with reference to converting the xml...
       · I have always problem with latin characters wich are transform by...
       · Hello again,Thank you for commenting on this article. I'm sorry that you're...
     

       

    PHP ARTICLES

    - Authentication Scripts for a User Management...
    - Utilizing the Use Keyword for Namespaces in ...
    - Building a User Management Application
    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT