#include "XMLInterface/Attribute.h"
#include "XMLInterface/Builder.h"
#include "XMLInterface/BuilderFac.h"
#include "XMLInterface/ChString.h"
#include "XMLInterface/Parser.h"
#include "XMLInterface/SAX2DefaultHandler.h"
#include "XMLInterface/SAX2Handler.h"
#include "XMLInterface/Stack.h"
#include "XMLInterface/boolBuilder.h"
#include "XMLInterface/doubleBuilder.h"
#include "XMLInterface/floatBuilder.h"
#include "XMLInterface/intBuilder.h"
#include "XMLInterface/shortBuilder.h"
#include "XMLInterface/stringBuilder.h"
#include "XMLInterface/uintBuilder.h"
#include "XMLInterface/ushortBuilder.h"
#include "XMLInterface/xmlfileBuilder.h"
#include "XMLInterface/timeBuilder.h"
Go to the source code of this file.
Namespaces | |
| namespace | xmli |
Functions | |
| int | Initialize () |
| int | ReadString (const char *text) |
| int | ReadFile (const char *file, bool absname=false) |
| int | ReadDirectory (const char *dir) |
| const char * | FindFile (const char *file, bool absname=false) |
| int | AddToPath (const char *dir, int where=1) |
| void | MakePath () |
| Parse the xmli_PATH variable into a list of directories. | |
Definition in file xmli.h.
|
||||||||||||
|
Insert a directory into the XML search path
Definition at line 166 of file xmli.cxx. References gsPath. Referenced by evdb::JobMenu::OpenJobXML(). 00167 {
00168 std::string s(dir);
00169 if (where>=0) gsPath.push_back(s);
00170 else gsPath.insert(gsPath.begin(),1,s);
00171 return 1;
00172 }
|
|
||||||||||||
|
Scan the XML path looking for a file "file"
Definition at line 139 of file xmli.cxx. References fexist(), and gsPath. Referenced by xmli::ReadFile(). 00140 {
00141 static std::string f;
00142
00143 if (absname==false) {
00144 std::vector<std::string>::iterator itr(gsPath.begin());
00145 std::vector<std::string>::iterator itrEnd(gsPath.end());
00146 for (; itr!=itrEnd; ++itr) {
00147 f = (*itr); f += "/"; f += file;
00148 if (fexist(f.c_str())) return f.c_str();
00149 }
00150 }
00151
00152 // Assume filename is absolute or relative to current working directory
00153 if (fexist(file)) return file;
00154
00155 return 0;
00156 }
|
|
|
Initialize the XML parsing system.
Definition at line 49 of file xmli.cxx. References xmli::MakePath(), and xmli::ReadFile(). Referenced by main(), and xmli::Parser::Parser(). 00050 {
00051 static bool init = false;
00052 if (init) return 0;
00053 init = true;
00054
00055 const char* d;
00056 xmli::MakePath();
00057
00058 std::string f("");
00059 d = getenv("HOME");
00060 if (d) f += d;
00061 f += "/.xmlirc.xml";
00062
00063 int nread = 0;
00064 nread += xmli::ReadFile(f.c_str(),true);
00065
00066 return nread;
00067 }
|
|
|
Parse the xmli_PATH variable into a list of directories. By default the path: "./:$SRT_PRIVATE_CONTEXT/xml:$SRT_PUBLIC_CONTEXT/xml" is provided. Contents of the xmli_PATH environment variable are prepended to this. Definition at line 185 of file xmli.cxx. References xmli::ChString::Split(). Referenced by xmli::Initialize(). 00186 {
00187 std::string path;
00188 const char* mxpath = getenv("XMLI_PATH");
00189 const char* srtpub = getenv("SRT_PUBLIC_CONTEXT");
00190 const char* srtpri = getenv("SRT_PRIVATE_CONTEXT");
00191
00192 if (mxpath) {
00193 path += mxpath;
00194 path += ":";
00195 }
00196 path += "./";
00197 if (srtpri) {
00198 path += ":";
00199 path += srtpri;
00200 path += "/xml";
00201 }
00202 if (srtpub) {
00203 if (srtpri) path += ":";
00204 path += srtpub;
00205 path += "/xml";
00206 }
00207 xmli::ChString::Split(path.c_str(),":",gsPath);
00208 }
|
|
|
Read all XML files contained inside a particular directory
Definition at line 113 of file xmli.cxx. References xmli::ReadFile(). Referenced by main(). 00114 {
00115 int i, n;
00116 int nread = 0;
00117 struct dirent** namelist;
00118
00119 n = scandir(dir, &namelist, 0, alphasort);
00120 if (n<1) return 0;
00121 for (i=0; i<n; ++i) {
00122 if (fnmatch("*.xml",namelist[i]->d_name,0)==0) {
00123 std::string nm = dir; nm += "/"; nm += namelist[i]->d_name;
00124 nread += xmli::ReadFile(nm.c_str(), true);
00125 }
00126 free(namelist[i]);
00127 }
00128 free(namelist);
00129 return nread;
00130 }
|
|
||||||||||||
|
Parse the entire contents of an XML file
Definition at line 93 of file xmli.cxx. References xmli::FindFile(), and xmli::Parser::ParseFile(). Referenced by xmli::xmlfileBuilder::Build(), xmli::Initialize(), main(), evdb::JobMenu::OpenJobXML(), and xmli::ReadDirectory(). 00094 {
00095 int nread = 0;
00096 xmli::Parser p;
00097 const char* f = xmli::FindFile(file, absname);
00098 if (f) {
00099 // std::cout << "xmli: Load file '" << f << "'" << std::endl;
00100 p.ParseFile(f);
00101 ++nread;
00102 }
00103 return nread;
00104 }
|
|
|
Parse a string containing XML tags
Definition at line 77 of file xmli.cxx. References xmli::Parser::ParseText(). Referenced by evdb::CfgEdit::EditConfig(). 00078 {
00079 xmli::Parser p;
00080 p.ParseText(text);
00081 return 1;
00082 }
|
1.3.9.1