June 2002
Intermediate to advanced
384 pages
7h 53m
English
The preceding section discussed traversing an already-extant DOM tree, demonstrating how the nodes of the tree can be processed in a recursive manner. That’s not all you can do with the DOM, though; it’s also possible to programmatically construct DOM trees from scratch, or modify existing tree structures, and save the result as one or more XML documents. This section discusses the details.
If you go back to the section dealing with PHP’s DOM classes, you’ll see that both the DomDocument and DomElement objects include functions to create new documents, nodes, and attributes. The first of these is the new_xmldoc() method of the DomDocument object, which constructs and returns a new instance of the ...