CHAPTER 6 DOCUMENT OBJECT MODEL (DOM) 211 Rob Richards 2005 Rob Richards The serialized tree looks almost exactly like the tree in Listing 6-1. This is good because that is the goal you are working toward. The only missing pieces are the prefaceand chapter subtrees. This will be left as an exercise for you to finish because I have already covered everything you need to complete the tree. Other Node Types The node types covered to this point are the most frequently used, which is why I have given them much greater emphasis. You can create and insert the remaining node types in the same manner as the previous nodes. Because the complete API is included in Appendix B, I will show how to create the remaining nodes through code: /* Create a DOMDocumentFragment */ $frag = $dom->createDocumentFragment(); $frag = new DOMDocumentFragment(); /* Create DOMComment */ $comment = $dom->createComment(”this is a comment”); $comment = new DOMComment(”this is a comment”); /* Results in */ /* Create DOMCDATASection */ $cdata = $dom->createCDATASection(”