src/smil.cpp

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

Generated on Sun Jun 25 23:35:45 2006 for libdaisy by  doxygen 1.4.6