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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.