コード例 #1
0
 private function serializeXML(\caption_record $caption, $includeBusinessFields)
 {
     $dom_doc = new \DOMDocument('1.0', 'UTF-8');
     $dom_doc->formatOutput = true;
     $dom_doc->standalone = true;
     $record = $dom_doc->createElement('record');
     $record->setAttribute('record_id', $caption->get_record()->get_record_id());
     $dom_doc->appendChild($record);
     $description = $dom_doc->createElement('description');
     $record->appendChild($description);
     foreach ($caption->get_fields([], $includeBusinessFields) as $field) {
         $values = $field->get_values();
         foreach ($values as $value) {
             $elem = $dom_doc->createElement($field->get_name());
             $elem->appendChild($dom_doc->createTextNode($this->sanitizeSerializedValue($value->getValue())));
             $elem->setAttribute('meta_id', $value->getId());
             $elem->setAttribute('meta_struct_id', $field->get_meta_struct_id());
             $description->appendChild($elem);
         }
     }
     $doc = $dom_doc->createElement('doc');
     $tc_datas = $caption->get_record()->get_technical_infos()->getValues();
     foreach ($tc_datas as $key => $data) {
         $doc->setAttribute($key, $data);
     }
     $record->appendChild($doc);
     return $dom_doc->saveXML();
 }