public function convert($key, $value, $format = null)
 {
     if ($format) {
     } elseif (isset($this->fieldInfo[$key]['type'])) {
         $format = strtolower(trim($this->fieldInfo[$key]['type']));
     } else {
         return (string) $value;
     }
     if ($format == 'int') {
         return (int) $value;
     } elseif ($format == 'decimal' || $format == 'float') {
         return (double) $value;
     } elseif ($format == 'json' || $format == 'js') {
         return DataTransclusionSource::decodeJson($value);
     } elseif ($format == 'wddx') {
         return DataTransclusionSource::decodeWddx($value);
     } elseif ($format == 'xml') {
         return DataTransclusionSource::parseXml($value);
         #WARNING: returns DOM
     } elseif ($format == 'php' || $format == 'pser') {
         return DataTransclusionSource::decodeSerialized($value);
     } else {
         return (string) $value;
     }
 }
 public function decodeData($raw, $format = null)
 {
     if ($format === null) {
         $format = $this->dataFormat;
     }
     if ($format == 'json' || $format == 'js') {
         return DataTransclusionSource::decodeJson($raw);
     } elseif ($format == 'wddx') {
         return DataTransclusionSource::decodeWddx($raw);
     } elseif ($format == 'xml') {
         return DataTransclusionSource::parseXml($raw);
     } elseif ($format == 'php' || $format == 'pser') {
         return DataTransclusionSource::decodeSerialized($raw);
     }
     return false;
 }