20.1. DOM XML

The Document Object Model (DOM) is an interface for allowing programs to read and update the elements of an XML document. Each element of the document appears as an object with methods and attributes a program can manipulate. One popular use of the DOM is JavaScript within browsers updating the contents of an HTML page. From PHP's perspective, the DOM allows a natural way of treating an XML document as an ordinary data structure. Compare this approach to that of the Expat XML functions discussed later in this chapter.

PHP wraps the GNOME XML library <http://www.xmlsoft.org/> in order to offer the functions described in this section. You can find the latest version of the specification at the W3C site: <http://www.w3.org/DOM/>. A ...

Get Core PHP Programming, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.