+ if (signer) {
+ root->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "dsig");
+ }
+
+ root->add_child("Id")->add_child_text ("urn:uuid:" + _id);
+ root->add_child("AnnotationText")->add_child_text (_annotation_text);
+ root->add_child("IssueDate")->add_child_text (_metadata.issue_date);
+ root->add_child("Issuer")->add_child_text (_metadata.issuer);
+ root->add_child("Creator")->add_child_text (_metadata.creator);
+ root->add_child("ContentTitleText")->add_child_text (_content_title_text);
+ root->add_child("ContentKind")->add_child_text (content_kind_to_string (_content_kind));
+ {
+ xmlpp::Node* cv = root->add_child ("ContentVersion");
+ cv->add_child ("Id")->add_child_text (_content_version_id);
+ cv->add_child ("LabelText")->add_child_text (_content_version_label_text);
+ }
+ root->add_child("RatingList");
+
+ xmlpp::Element* reel_list = root->add_child ("ReelList");
+
+ BOOST_FOREACH (shared_ptr<Reel> i, _reels) {
+ i->write_to_cpl (reel_list, standard);
+ }
+
+ if (signer) {
+ signer->sign (root, standard);
+ }
+
+ /* This must not be the _formatted version otherwise signature digests will be wrong */
+ doc.write_to_file (file.string (), "UTF-8");
+
+ set_file (file);