Ginga  0.13.6
 All Classes Namespaces Functions Variables
DocumentParser.h
1 /******************************************************************************
2 Este arquivo eh parte da implementacao do ambiente declarativo do middleware
3 Ginga (Ginga-NCL).
4 
5 Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia
6 
7 Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob
8 os termos da Licenca Publica Geral GNU versao 2 conforme publicada pela Free
9 Software Foundation.
10 
11 Este programa eh distribuido na expectativa de que seja util, porem, SEM
12 NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU
13 ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do
14 GNU versao 2 para mais detalhes.
15 
16 Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto
17 com este programa; se nao, escreva para a Free Software Foundation, Inc., no
18 endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
19 
20 Para maiores informacoes:
21 ncl @ telemidia.puc-rio.br
22 http://www.ncl.org.br
23 http://www.ginga.org.br
24 http://www.telemidia.puc-rio.br
25 ******************************************************************************
26 This file is part of the declarative environment of middleware Ginga (Ginga-NCL)
27 
28 Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
29 
30 This program is free software; you can redistribute it and/or modify it under
31 the terms of the GNU General Public License version 2 as published by
32 the Free Software Foundation.
33 
34 This program is distributed in the hope that it will be useful, but WITHOUT ANY
35 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
36 PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
37 details.
38 
39 You should have received a copy of the GNU General Public License version 2
40 along with this program; if not, write to the Free Software
41 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
42 
43 For further information contact:
44 ncl @ telemidia.puc-rio.br
45 http://www.ncl.org.br
46 http://www.ginga.org.br
47 http://www.telemidia.puc-rio.br
48 *******************************************************************************/
49 
50 #ifndef DocumentParser_H
51 #define DocumentParser_H
52 
53 #include <iostream>
54 #include <string>
55 #include <map>
56 #include <vector>
57 using namespace std;
58 
59 #include <xercesc/dom/DOM.hpp>
60 XERCES_CPP_NAMESPACE_USE
61 
62 #include "util/functions.h"
63 using namespace ::br::pucrio::telemidia::util;
64 
65 #include "XMLParsing.h"
66 
67 namespace br {
68 namespace pucrio {
69 namespace telemidia {
70 namespace converter {
71 namespace framework {
73  protected:
74  string documentPath;
75  string userCurrentPath;
76  string documentUri;
77  string iUriD;
78  string fUriD;
79  DOMDocument *documentTree;
80  map<string, void*>* genericTable;
81 
82  public:
84  virtual ~DocumentParser();
85 
86  protected:
87  virtual void initialize()=0;
88 
89  public:
90  void* parse(string uri, string iUriD, string fUriD);
91  void* parse(DOMElement* rootElement, string uri);
92 
93  protected:
94  virtual void setDependencies();
95  virtual void* parseRootElement(DOMElement *rootElement)=0;
96 
97  private:
98  void initializeUserCurrentPath();
99  string absoluteFile(string basePath, string filename);
100  string getPath(string filename);
101 
102  public:
103  string getIUriD();
104  string getFUriD();
105  string getUserCurrentPath();
106  bool checkUriPrefix(string uri);
107  bool isAbsolutePath(string path);
108  bool isXmlStr(string location);
109 
110  string getAbsolutePath(string path);
111  string getDocumentUri();
112  string getDocumentPath();
113  void setDocumentPath(string path);
114  DOMDocument *getDocumentTree();
115  void addObject(string tableName, string key, void* value);
116  void* getObject(string tableName, string key);
117  void removeObject(string tableName, string key);
118  void addObjectGrouped(string tableName, string key, void* value);
119  bool importDocument(DocumentParser* parser, string docLocation);
120  };
121 }
122 }
123 }
124 }
125 }
126 
127 #endif //DocumentParser_H