PHP
  Home arrow PHP arrow A Quick Overview of the XML DOM Extension in PHP 5
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
PHP

A Quick Overview of the XML DOM Extension in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 10
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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 ARTICLES

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek