protected function parseCategories($response, &$categories) { global $smwgSPARQLResultEncoding; // PHP strings are always interpreted in ISO-8859-1 but may be actually encoded in // another charset. if (isset($smwgSPARQLResultEncoding) && $smwgSPARQLResultEncoding == 'UTF-8') { $response = utf8_decode($response); } $dom = simplexml_load_string($response); $titles = array(); $results = $dom->xpath('//result'); foreach ($results as $r) { //$children = $r->children(); // binding nodes $b = $r->binding[0]; // categories foreach ($b->children()->uri as $sv) { $category = TSHelper::getTitleFromURI((string) $sv); if (!is_null($category)) { $categories[] = $category; } } } }