src/smil.cpp

00001 #include "smil.h"
00002 
00003 namespace freedaisy {
00004   SMIL::SMIL() {
00005     _xmldoc = NULL;
00006     createDoc();
00007   }
00008 
00009   void SMIL::createDoc() {
00010     _createDoc();
00011     XMLNode smil = createRootNode("smil");
00012 
00013     XMLNode head("head");
00014     smil.addChild(&head);
00015 
00016     XMLNode metaformat("meta");
00017     metaformat.setAttr("name", "dc:format");
00018     metaformat.setAttr("content", "Daisy 2.02");
00019     head.addChild(&metaformat);
00020 
00021     // <T> layout ?
00022 
00023     XMLNode body("body");
00024     smil.addChild(&body);
00025   }
00026 
00027   Par SMIL::findAnchor(std::string id) {
00028     std::vector<XMLNode> nodes;
00029 
00030     // Find in par nodes
00031     nodes = xpathEval("//smil/body/seq/par[@id='" + id + "']");
00032     if (nodes.size() > 0) {
00033       return Par(nodes[0]);
00034     }
00035 
00036     // Otherwise, find in text nodes
00037     std::vector<XMLNode> textnode;
00038     textnode = xpathEval("//smil/body/seq/par/text[@id='" + id + "']");
00039     if (textnode.size() > 0) {
00040       return Par(textnode[0].getParent());
00041     }
00042 
00043     // Nothing found
00044   }
00045 }

Generated on Sun Jun 25 20:48:22 2006 for libdaisy by  doxygen 1.4.6