PHP
  Home arrow PHP arrow Working with Attributes and CDATA Sections with the DOM XML Extension
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? 
PHP

Working with Attributes and CDATA Sections with the DOM XML Extension
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2008-03-04


    Table of Contents:
  • Working with Attributes and CDATA Sections with the DOM XML Extension
  • Reviewing some methods of the DOM XML extension
  • Working with the createAttribute() method
  • Inserting CDATA nodes into an XML document

  • 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


    Working with Attributes and CDATA Sections with the DOM XML Extension
    ( Page 1 of 4 )

    Undeniably, one of the most remarkable strengths of PHP is its robust set of extensions. They provide developers with the right tools to build a huge variety of web applications with minor hassles. And this characteristic is particularly evident when it comes to working with XML documents, since PHP comes packaged with a bunch of powerful libraries that allow it to handle XML data in all sorts of clever ways.

    A good example of this is the popular “SimpleXML” extension, which comes in handy when performing the most common operation required to work with XML documents -- using an approachable, easy-to-learn API. You might think that this library is the only one bundled with PHP that can be used to handle XML data, but this is completely erroneous.

    There’s a PHP library that permits you to work with XML documents by using the DOM API. Does this name ring any bells for you? Yes, you’re right! Fortunately, PHP also provides programmers with the helpful DOM XML extension, which, as its name suggests, can be quite useful when processing XML documents via the Document Object Model.

    Basically, this implies that you’ll be able to build XML documents from scratch, create and append new nodes, remove existing ones, work with custom attributes, etc., by using the methods offered by the DOM API, which include the popular “createElement(),” appendChild(),” and “getElementById().”

    Of course, if you're used to working with JavaScript on a frequent basis, then the previous methods will be pretty familiar to you. But if you haven’t had the chance to develop client-side applications, you might want to read this article series to learn how to get started using the DOM XML extension bundled with PHP.

    And speaking of the numerous features offered by this library, in the first article of the series I explained how to use some of its simplest methods to perform certain basic tasks on XML data, such as building new documents, creating elements and inserting nodes, and finally echoing the whole output to a browser.

    However, this is merely a humble beginning, since the DOM XML library comes equipped with many other methods that can be useful for adding custom attributes to the existing nodes of a given XML document, and creating new CDATA sections, among other things. Therefore, assuming that all these topics are really interesting to you, in this second part of the series I’ll be discussing them in detail and logically accompanying the corresponding theoretical concepts with illustrative hands-on examples.

    Does all this material sound good to you? Great! Let’s continue this journey now!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





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