diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-10-10 16:07:44 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-10-10 16:07:44 +0100 |
| commit | e30c30ef7bbd8413ac0c8390abe574d5dd1cf5f7 (patch) | |
| tree | f67b4a9364264d433535dbc24a19b6df6ac59049 /src/cpl.cc | |
| parent | 863ff8cced5b7d1d36ad6761fa1f6e2dbeafcad6 (diff) | |
Adapt to new libcxml ARI. Compiles but does not pass tests.1.0-new-cxml
Diffstat (limited to 'src/cpl.cc')
| -rw-r--r-- | src/cpl.cc | 63 |
1 files changed, 31 insertions, 32 deletions
@@ -61,33 +61,32 @@ CPL::CPL (boost::filesystem::path file) : Asset (file) , _content_kind (FEATURE) { - cxml::Document f ("CompositionPlaylist"); - f.read_file (file); + cxml::NodePtr f = cxml::read_file (file); - _id = f.string_child ("Id"); + _id = f->string_child ("Id"); if (_id.length() > 9) { _id = _id.substr (9); } - _annotation_text = f.optional_string_child ("AnnotationText").get_value_or (""); - _metadata.issuer = f.optional_string_child ("Issuer").get_value_or (""); - _metadata.creator = f.optional_string_child ("Creator").get_value_or (""); - _metadata.issue_date = f.string_child ("IssueDate"); - _content_title_text = f.string_child ("ContentTitleText"); - _content_kind = content_kind_from_string (f.string_child ("ContentKind")); - shared_ptr<cxml::Node> content_version = f.optional_node_child ("ContentVersion"); + _annotation_text = f->optional_string_child ("AnnotationText").get_value_or (""); + _metadata.issuer = f->optional_string_child ("Issuer").get_value_or (""); + _metadata.creator = f->optional_string_child ("Creator").get_value_or (""); + _metadata.issue_date = f->string_child ("IssueDate"); + _content_title_text = f->string_child ("ContentTitleText"); + _content_kind = content_kind_from_string (f->string_child ("ContentKind")); + cxml::NodePtr content_version = f->optional_child ("ContentVersion"); if (content_version) { _content_version_id = content_version->optional_string_child ("Id").get_value_or (""); _content_version_label_text = content_version->string_child ("LabelText"); content_version->done (); } - f.ignore_child ("RatingList"); + f->ignore_child ("RatingList"); _reels = type_grand_children<Reel> (f, "ReelList", "Reel"); - f.ignore_child ("Issuer"); - f.ignore_child ("Signer"); - f.ignore_child ("Signature"); + f->ignore_child ("Issuer"); + f->ignore_child ("Signer"); + f->ignore_child ("Signature"); - f.done (); + f->done (); } /** Add a reel to this CPL. @@ -107,33 +106,33 @@ CPL::add (boost::shared_ptr<Reel> reel) void CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr<const Signer> signer) const { - xmlpp::Document doc; - xmlpp::Element* root; + cxml::NodePtr root (new cxml::Node); + root->set_name ("CompositonPlaylist"); if (standard == INTEROP) { - root = doc.create_root_node ("CompositionPlaylist", "http://www.digicine.com/PROTO-ASDCP-CPL-20040511#"); + root->set_attribute ("xmlns", "http://www.digicine.com/PROTO-ASDCP-CPL-20040511#"); } else { - root = doc.create_root_node ("CompositionPlaylist", "http://www.smpte-ra.org/schemas/429-7/2006/CPL"); + root->set_attribute ("xmlns", "http://www.smpte-ra.org/schemas/429-7/2006/CPL"); } if (signer) { - root->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "dsig"); + root->set_attribute ("xmlns:dsig", "http://www.w3.org/2000/09/xmldsig#"); } - 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)); + root->add_child("Id")->set_content ("urn:uuid:" + _id); + root->add_child("AnnotationText")->set_content (_annotation_text); + root->add_child("IssueDate")->set_content (_metadata.issue_date); + root->add_child("Issuer")->set_content (_metadata.issuer); + root->add_child("Creator")->set_content (_metadata.creator); + root->add_child("ContentTitleText")->set_content (_content_title_text); + root->add_child("ContentKind")->set_content (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); + cxml::NodePtr cv = root->add_child ("ContentVersion"); + cv->add_child ("Id")->set_content (_content_version_id); + cv->add_child ("LabelText")->set_content (_content_version_label_text); } root->add_child("RatingList"); - xmlpp::Element* reel_list = root->add_child ("ReelList"); + cxml::NodePtr reel_list = root->add_child ("ReelList"); for (list<shared_ptr<Reel> >::const_iterator i = _reels.begin(); i != _reels.end(); ++i) { (*i)->write_to_cpl (reel_list, standard); @@ -144,7 +143,7 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr<cons } /* This must not be the _formatted version otherwise signature digests will be wrong */ - doc.write_to_file (file.string (), "UTF-8"); + cxml::write_to_file (root, file.string ()); set_file (file); } |
