PHP
  Home arrow PHP arrow A Quick Overview of the XML DOM Extens...
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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

A Quick Overview of the XML DOM Extension in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    2008-02-26

    Table of Contents:
  • A Quick Overview of the XML DOM Extension in PHP 5
  • Building XML documents from scratch
  • Adding multiple nodes to an XML document
  • Adding nodes to a simple XML document by using array elements

  • 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

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    A Quick Overview of the XML DOM Extension in PHP 5
    (Page 1 of 4 )

    To be frank, how many times in your life as a PHP developer have you had to deal with XML documents? Probably dozens of times, particularly if you use it to develop PHP applications that implement some kind of web service, or possibly when creating RSS feeds and template files for different web sites. And, surely, the list goes on and on.

    But wait a minute! Of course, I’m not saying that XML is the evil player of this game, because you’d be completely misunderstanding my point. XML is great for different reasons, which are definitely out of the scope of this article. But when you need to build large XML documents from scratch or even parse them in some way, you can be faced with a quite challenging and time-consuming process that might cause hair loss!

    However, as you know, PHP 5 comes equipped with a number of extensions that will make your life much easier when it comes to building and parsing things like XML data. For example, there’s the “SimpleXML” library, which permits you to perform some useful tasks, such as reading XML data from files and strings, iterating over XML documents, parsing individual nodes, and so forth.

    PHP 5 has yet another extension that can be really helpful for handling XML data in all sorts of clever ways. In this case, I’m talking about the one called “XML DOM.” If you’ve already worked with it during the development of your PHP 5 applications, then you should be well aware of its strong capabilities when it comes to dealing with XML data.

    Of course, there’s the possibility that aside from being a PHP programmer, you’re also a professional diver, who spends most of your time exploring the beauty of the oceans and, in consequence, you've never heard about this PHP extension. In that case, let me tell you a couple of interesting things that you can do with it.

    Simply put, the DOM XML extension, as its name suggests, will permit you to work on XML documents by way of the DOM API. In this way, it allows you to read from and write to XML files, build XML data from scratch and parse specific nodes, extract them as an array, and even process HTML markup in different ways by using a handful of intuitive methods that closely resemble the ones used with JavaScript.

    As you can see, this PHP extension offers a bunch of powerful features that can be useful for working with XML data. Therefore, provided that you’re interested in learning how to get started using it within your own PHP applications, in this article series I’ll be discussing some of its most relevant methods and properties and accompanying all of these explanations with concise and instructive hands-on examples.

    Does this sound good to you? Let’s get started right now!

    More PHP Articles
    More By Alejandro Gervasio


       · PHP 5 comes equipped with a useful extension, called DOM XML, which its name...
     

       

    PHP ARTICLES

    - Setting Up a Web-based Image Hosting Service
    - Comparing Files and Databases with PHP Bench...
    - Setting Up a Web-Based Image Gallery
    - Using Timers to Benchmark PHP Applications
    - Benchmarking Applications with PHP
    - Setting Up a Web-Based File Manager: PHPfile...
    - Developing a Modular Class For a PHP File Up...
    - Setting Up a Web-Based File Manager: bfExplo...
    - Defining a Custom Function for File Uploader...
    - Parsing Child Nodes with the DOM XML extensi...
    - Creating an Error Handling Module for a PHP ...
    - Accessing Attributes and Cloning Nodes with ...
    - Retrieving Information on Selected Files wit...
    - Handling HTML Strings and Files with the DOM...
    - Building File Uploaders with PHP 5

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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