Example #1
0
            $data[$label]['sum'] += $len;
            $data[$label]['cnt']++;
        }
        foreach ($data as $label => $d) {
            $data[$label]['avg'] = round($d['sum'] / $d['cnt'], 0);
            if (!in_array($label, $this->labels)) {
                $this->labels[] = $label;
            }
        }
        $this->predata[] = $data;
        return $data;
    }
}
$input = new phpucJTLInput();
$dom = new DOMDOcument();
$dom->load($jtl);
$xpath = new DOMXPath($dom);
$input->processLog($xpath);
$nodes = $xpath->query('//testResults/sampleResult/@threadName');
$threadNames = array();
foreach ($nodes as $node) {
    $name = preg_replace('/ \\d+-\\d+$/S', '', $node->nodeValue);
    if (!in_array($name, $threadNames)) {
        $threadNames[] = $name;
    }
}
echo "Create JMeter result graphs... \n";
foreach ($threadNames as $threadName) {
    echo ' + ' . $threadName . '... ';
    $chart = new JTLLineChart();
    $chart->xpath = $xpath;
<?php

// Consider the following script:
$dom = new DOMDOcument();
$dom->load('0138.xml');
foreach ($dom->documentElement->childNodes as $child) {
    if ($child->nodeType == XML_ELEMENT_NODE && $child->nodeName == "item") {
        foreach ($child->childNodes as $item) {
            if ($item->nodeType == XML_ELEMENT_NODE && $item->nodeName == "title") {
                print "{$item->firstChild}->data\n";
            }
        }
    }
}
// Assuming the referenced XML document exists and matches the parsing logic, what should be displayed when this script is executed?
/*
1) None of the above															OK
2) The XML of each 'title' node
3) The XML of each 'item' node
4) "Title" for every title node in the document
5) The contents of every 'title' node which exists under an 'item' node
*/