PHP
  Home arrow PHP arrow Accessing Attributes and Cloning Nodes with the DOM XML 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

Accessing Attributes and Cloning Nodes with the DOM XML Extension in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 3
    2008-04-01


    Table of Contents:
  • Accessing Attributes and Cloning Nodes with the DOM XML Extension in PHP 5
  • Accessing attributes of XML nodes with the getAttribute() method
  • Determining the existence of attributes for a specific XML node with the has Attribute() method
  • Cloning nodes of an XML document with the cloneNode() method

  • 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


    Accessing Attributes and Cloning Nodes with the DOM XML Extension in PHP 5
    ( Page 1 of 4 )

    You've probably realized that the DOM XML library can be pretty useful when working with web documents. However, this extension includes some other methods, which can be utilized to parse attributes of a given XML string, as well as to clone nodes. Thus, considering that you may want to learn the basics of how to use them, in this sixth part of the series I’ll be taking a closer look at them by way of some approachable, yet educational, code samples.

    One of the things that has made PHP so popular with web developers is its easy learning curve, along with its flexibility, particularly when it comes to building web applications that cover a huge variety of needs. This versatility becomes evident when working with XML documents, since PHP comes equipped with a decent number of built-in extensions that allow it to handle XML data in all sorts of clever ways without putting you through a painful experience.

    Naturally, it’s impossible to cover all of these XML-related extensions in only one series of articles, and it’s certainly not my intention to do that. However, as you might have guessed, the objective of this set of tutorials is to teach you how to use the most relevant methods that come bundled with one of these helpful extensions, “DOM XML.” It permits you to work with XML documents in a relatively easy way using the API provided by the Document Object Model.

    Therefore, if you want to learn how to put this useful XML handling library to work for you with minor hassles, I recommend you start reading this article series. Hopefully by the end of it, you’ll be armed with a solid background in using the methods provided by the DOM API, which processes XML documents without making you suffer chronic headaches.

    Now that I've introduced you to the main subject of this series, it’s time to recapitulate the themes that were covered in the last article. You’ll possibly recall that in the course of the preceding tutorial, I explained how to use a few helpful methods that come bundled with the DOM XML extension, “loadHTMLFile()”, “saveHTMLFile()”, and “loadHTML()” respectively, to perform some basic operations with HTML documents, such as saving them to a destination file, reading their contents from a specified file location, and so forth.

    So, are you ready to learn how to work with attributes and child nodes using the DOM XML extension? Let’s get started!



     
     
    >>> 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 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek