212 CHAPTER 6 DOCUMENT OBJECT MODEL (DOM)
212 CHAPTER 6 DOCUMENT OBJECT MODEL (DOM) /* Create DOMEntityReference */ $entityref = $dom->createEntityReference(”lt”); $entityref = new DOMEntityReference(”lt”); /* Results in < */ Outside the methods inherited from the DOMNode class, the DOMDocumentFragment class is the only class with additional functionality. This functionality is only a single method and available only in PHP 5.1 and higher. Rather than having to build a fragment manually by appending nodes, you can use the method appendXML() to create a fragment from string data. Take the case of building a fragment manually versus building it from a string: $frag = $dom->createDocumentFragment(); $frag->appendChild(new DOMElement(”node1″, “node1 value”)); $frag->appendChild(new DOMElement(”node2″, “node2 value”)); It would have been so much easier to append the data as a string. You had no need to manually create the DOMElement objects because the appropriate nodes are automatically created through the appendXML() method: $frag = $dom->createDocumentFragment(); $frag->appendXML(”
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP MySQL Web Hosting services