Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

XMLTagManager.h

Go to the documentation of this file.
00001 
00002 //
00003 // This file is part of the MADELINE 2 program 
00004 // written by Edward H. Trager, Ritu Khanna, and Adrian Marrs
00005 // Copyright (c) 2006 by the
00006 // Regents of the University of Michigan.
00007 // All Rights Reserved.
00008 // 
00009 // The latest version of this program is available from:
00010 // 
00011 //   http://eyegene.ophthy.med.umich.edu/madeline/
00012 //   
00013 // Released under the GNU General Public License.
00014 // A copy of the GPL is included in the distribution
00015 // package of this software, or see:
00016 // 
00017 //   http://www.gnu.org/copyleft/
00018 //   
00019 // ... for licensing details.
00020 // 
00022 //
00023 // 2006.08.16.
00024 //
00025 
00026 //
00027 // Individual.h
00028 //
00029 #ifndef XMLTagManager_INCLUDED
00030 #define XMLTagManager_INCLUDED
00031 
00032 #include <iostream>
00033 #include <vector>
00034 
00036 //
00037 // XMLTagNames: Hold information about
00038 // the names of the XML tags used by
00039 // various XML formats.
00040 // 
00042 class XMLTagNames
00043 {
00044         
00045 private:
00046         
00047         std::string _formatName;
00048         std::string _id;
00049         std::string _cellTag;
00050         std::string _tableTag;
00051         std::string _rowTag;
00052         std::string _columnTag;
00053         std::string _textTag;
00054         std::string _repeat;
00055         bool        _cellHasChildXMLNode;
00056         
00057 public:
00058         
00059         //
00060         // Constructors:
00061         //
00062         XMLTagNames(){}
00063         XMLTagNames( const char *formatName,const char *id,const char *cellTag,const char *tableTag,const char *rowTag,const char *columnTag,const char *textTag,const char *repeat,bool cellHasChildXMLNode);
00064         
00065         //
00066         // Get methods:
00067         //
00068         std::string getFormatName() const;
00069         std::string getId() const;
00070         std::string getCellTagName() const;
00071         std::string getTableTagName() const;
00072         std::string getRowTagName() const;
00073         std::string getColumnTagName() const;
00074         std::string getTextTagName() const;
00075         std::string getRepeatAttributeName() const;
00076         bool        cellHasChildXMLNode() const;
00077 };
00078 
00079 
00081 //
00082 // XMLTagManager: Manages details about 
00083 //                the type and tag names of a 
00084 //                given XML format
00085 //                
00087 class XMLTagLoader;
00088 class XMLTagManager{
00089         
00090         friend class XMLTagLoader;
00091         
00092 private:
00093         
00094         int _formatId;
00095         
00096         static std::vector< XMLTagNames > _tags;
00097         
00098         
00099 public:
00100         
00101         //
00102         // Constructors:
00103         //
00104         XMLTagManager(){ _formatId= -1; };
00105         XMLTagManager(const std::string &data);
00106         
00107         bool discoverFormat(const std::string &data);
00108         
00109         std::string getFormatName() const;
00110         std::string getId() const;
00111         std::string getCellTagName() const;
00112         std::string getTableTagName() const;
00113         std::string getRowTagName() const;
00114         std::string getColumnTagName() const;
00115         std::string getTextTagName() const;
00116         std::string getRepeatAttributeName() const;
00117         bool        cellHasChildXMLNode() const;
00118         
00119 };
00120 
00122 //
00123 // XMLTagLoader(): Loader class to load
00124 // the static data of the XMLTagManager class.
00125 //
00127 class XMLTagLoader{
00128         
00129 public:
00130         static XMLTagLoader xmlTagLoader;
00131         XMLTagLoader(){
00132                 // madeline
00133                 XMLTagManager::_tags.push_back(XMLTagNames("Madeline-XML","</madeline-xml>","d","table","row","col","","",false));
00134                 // xhtml:
00135                 XMLTagManager::_tags.push_back(XMLTagNames("W3C XHTML","</html>","td","table","tr","","","",false));
00136                 // OASIS:
00137                 XMLTagManager::_tags.push_back(XMLTagNames("OpenOffice.org OASIS","</office:document-content>","table-cell","table","table-row","table-col","p","number-columns-repeated",true));
00138                 // Microsoft
00139                 XMLTagManager::_tags.push_back(XMLTagNames("Microsoft XML","</Workbook>","Cell","Table","Row","Column","Data","number-columns-repeated",true));
00140                 
00141         }
00142         
00143 };
00144 
00145 #endif

Generated on Fri Nov 18 16:24:39 2011 for MADELINE by  doxygen 1.4.4