Home arrow PHP arrow Working with Multiple Document Nodes with the DOM XML Extension in PHP 5

Working with Multiple Document Nodes with the DOM XML Extension in PHP 5

Welcome to the fourth article of the series "A quick overview of the DOM XML extension in PHP 5." By means of easy-to-grasp hands-on examples, this series equips you with a friendly guide to using the most relevant methods that come bundled with the DOM XML PHP extension to help you work with XML documents in a truly painless way.

  1. Working with Multiple Document Nodes with the DOM XML Extension in PHP 5
  2. Getting a collection of XML nodes
  3. Loading XML data from a specified text file with the load() method
  4. Reading data from a specified XML string with the loadXML() method
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
March 18, 2008

print this article



If you’re a PHP developer who builds web applications that work with XML documents on a frequent basis, then there’s good news for you. This powerful server-side scripting language comes equipped with an extension, DOM XML, which permits you to handle XML data directly through the API provided by the Object Document Model.

Naturally, as with everything in life, learning the principal features offered by this XML-related PHP extension takes a while, but you can drive on the fast lane and save much of your time an effort by reading this group of articles right now!

At this point, having introduced the main subject of this article series, I’d like to spend a little time recapitulating the items that were discussed in the previous tutorial, just in case you didn’t have a chance to read it.

In that installment I explained how to use a couple of helpful methods included with the DOM XML extension, named “createComment()” and “createCDATASection()” respectively, which not surprisingly came in handy for inserting comments and CDATA nodes into an existing XML document.

Since appending comments and CDATA sections to a particular XML document tree was accomplished by using the DOM API, the whole process was simple, meaning that you shouldn’t have major problems understanding how these methods do their respective things.

So far, so good. At this stage, I quickly reviewed the topics treated in the previous article of the series, so it’s time to learn a few other methods included with the DOM XML extension. Based upon this premise, in this fourth tutorial I’m going to show you how to get access to multiple nodes of an XML document, either for internal processing or simply for echoing to the browser.

As you may have guessed, these multi-node operations require working with brand new methods of the DOM XML library, so let’s not waste more time in preliminaries. 

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: