Skip to Content


Nice Examples of XML and DOMDocument

Its all about the DOMDocument and generating the XML from the same with examples. I have created some of the good documents with the examples for generating the xml and formatting the same. You will get most of the functions with the examples are written in the following post :
$dom = new DOMDocument('1.0', 'UTF-8');
$root = $dom->createElement('root');
echo $dom->saveXML();
1. Creating XML Document and Displaying :


Pareto principle

Mathematically, where something is shared among a sufficiently large set of participants, there must be a number k between 50 and 100 such that "k% is taken by (100 − k)% of the participants. The number k may vary from 50 (in the case of equal distribution, i.e. 100% of the population have equal shares) to nearly 100 (when a tiny number of participants account for almost all of the resource). There is nothing special about the number 80% mathematically, but many real systems have k somewhere around this region of intermediate imbalance in distribution.


Generating xml from text file

error_reporting(E_ALL); ini_set("display_errors", 1); $handle = @fopen("site_hierarchy.txt", "r"); if ($handle) { /** Creating the root element in the xml **/ $doc = new DOMDocument("1.0"); // Read File Line By Line $prevCount = -1; $prevNode = NULL; $prevNode = $doc->createElement("root"); $doc->appendChild($prevNode); while (($fileContent = fgets($handle, 4096)) !== false) { $count = 0; $newStrLine = $fileContent; $newStrLine = str_replace("\t","" , $newStrLine, $count); $child = createTerms($doc,$newStrLine); if ( $prevCount < $count ) { $prevNode = $prevNode->appendChild($ch


Moodle 1.9 Course completion not present

Hi, I have gone through one of the requirement stating that in



Subscribe to RSS - blogs