/** * @param DOMElement $cell * * @throws OLAPException */ private function getTypedValue(DOMElement $cell) { $element = XMLAUtil::findChild($cell, XMLAUtil::MDDATASET_NS, 'Value'); if ($element == null) { return null; } // The object type is contained in xsi:type attribute. $type = $element->attributes->getNamedItem('xsi:type'); try { switch ($type) { case 'xsd:int': return XMLAUtil::integerElement($cell, 'Value'); case 'xsd:double': return XMLAUtil::doubleElement($cell, 'Value'); case 'xsd:float': return XMLAUtil::floatElement($cell, 'Value'); case 'xsd:long': return XMLAUtil::longElement($cell, 'Value'); case 'xsd:boolean': return XMLAUtil::booleanElement($cell, 'Value'); default: return XMLAUtil::stringElement($cell, 'Value'); } } catch (Exception $e) { throw new OLAPException('Error while casting a cell value to the correct php type for' . ' its XSD type ' . $type); } }