PHP
  Home arrow PHP arrow Parsing Child Nodes with the DOM XML e...
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

Parsing Child Nodes with the DOM XML extension in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2008-04-08

    Table of Contents:
  • Parsing Child Nodes with the DOM XML extension in PHP 5
  • Reintroducing a few methods of the DOM XML extension
  • Working with the hasChildNodes() method
  • The removeChild() method

  • 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.

    Parsing Child Nodes with the DOM XML extension in PHP 5
    (Page 1 of 4 )

    In this last chapter of the series, I’m going to teach you how to handle the child nodes of an XML document by way of two simple methods, called hasChildNode() and removeChild() respectively. So let’s not waste any more time in preliminaries and learn how to use them in a helpful way.

    During your life as a PHP developer, it’s quite possible that you've already built web applications that work with XML documents that needed to be parsed in one form or another. Of course, based on your own experience, you know that this process can be challenging, since handling XML data requires frequently traversing document nodes, dealing with attributes, copying elements from one place to another, and so forth.

    Fortunately, PHP comes packaged with a powerful extension, called DOM XML, that can be used to work on XML documents by using the API provided by the Document Object Model (commonly known as DOM). Thus, if you wish to learn the most important methods provided by this XML library, then this series of articles may be what you’re looking for.

    Welcome to the final part of the series “A quick overview of the DOM XML extension in PHP 5.” It is made up of seven approachable tutorials that go through some of the most relevant features that come bundled with this helpful PHP extension and is aimed at parsing XML documents in a painless way.

    Having already established the objective of this series of articles, now I’m going to briefly rehash the items that were treated in the preceding tutorial, so you can link them more easily with what I plan to discuss in this last installment. In the aforementioned article, I demonstrated how to retrieve the attributes corresponding to a certain number of nodes within an XML document via the “getAttribute()” method.

    In addition to teaching you how to work with the previous method, I showed you another one, called “hasAttribute()”, which came in handy for determining whether a particular element of an XML document contained an attribute or not. And lastly, I finished the tutorial by teaching you how to clone different nodes using the “cloneNode()” method, which is a process that hopefully was quite easy to understand.

    So far, so good. At this stage, you’re armed with the right pointers to start using some of the most useful methods that come included with the DOM XML extension. However, the question that comes up now is:  are there any additional features that still remain uncovered? Actually, this library has many other methods that can be useful for parsing XML documents, but in this last part of the series, I’ll be covering only a couple more. If you want to have a full reference guide on the DOM XML extension, the best place to go is the official PHP website.

    Let’s get started now!

    More PHP Articles
    More By Alejandro Gervasio


       · In this last chapter of the series, you’ll learn how to use the DOM XML PHP...
     

       

    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 3 hosted by Hostway