Classes | |
| class | Attribute |
| Encapulate the name/value pairs which appear inside XML tags. More... | |
| class | boolBuilder |
| Builder of a vector<bool> from XML data. More... | |
| class | Builder |
| Base class for classes which construct C++ objects from XML data. More... | |
| class | BuilderFac |
| A factory for classes which build C++ objects from XML. More... | |
| class | ChString |
| Wrap XMLCh as C++ string and other utilities for strings. More... | |
| class | doubleBuilder |
| Builder a vector<double> from XML data. More... | |
| class | floatBuilder |
| Builder for vector<float> from XML data. More... | |
| class | intBuilder |
| Builder for a vector<int> from XML data. More... | |
| class | Parser |
| Construct a parser for XML text. More... | |
| class | SAX2DefaultHandler |
| Define a SAX2 handler for XML files. More... | |
| class | SAX2Handler |
| SAX2 handler for each tag defined in an XML file. More... | |
| class | shortBuilder |
| Builder of vector<short> from XML data. More... | |
| class | Stack |
| A templated stack class to hold objects created from XML data. More... | |
| class | stringBuilder |
| Builder for vector<string> using XML data. More... | |
| class | uintBuilder |
| class | ushortBuilder |
| Build a vector of shorts from XML data. More... | |
| class | xmlfileBuilder |
| Handle the xmlfile tag which defines a list of XML files to parse. More... | |
Typedefs | |
| typedef std::vector< xmli::Attribute > | AttributeList |
| Wrap-up definition of a list of XML Attributes. | |
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. | |
|
|
||||||||||||
|
Insert a directory into the XML search path
Definition at line 165 of file xmli.cxx. References gsPath. Referenced by evdb::JobMenu::OpenJobXML().
|
|
||||||||||||
|
Scan the XML path looking for a file "file"
Definition at line 138 of file xmli.cxx. References fexist(), and gsPath. Referenced by ReadFile().
00139 {
00140 static std::string f;
00141
00142 if (absname==false) {
00143 std::vector<std::string>::iterator itr(gsPath.begin());
00144 std::vector<std::string>::iterator itrEnd(gsPath.end());
00145 for (; itr!=itrEnd; ++itr) {
00146 f = (*itr); f += "/"; f += file;
00147 if (fexist(f.c_str())) return f.c_str();
00148 }
00149 }
00150
00151 // Assume filename is absolute or relative to current working directory
00152 if (fexist(file)) return file;
00153
00154 return 0;
00155 }
|
|
|
Initialize the XML parsing system.
Definition at line 48 of file xmli.cxx. References MakePath(), and ReadFile(). Referenced by main().
00049 {
00050 static bool init = false;
00051 if (init) return 0;
00052 init = true;
00053
00054 const char* d;
00055 xmli::MakePath();
00056
00057 std::string f("");
00058 d = getenv("HOME");
00059 if (d) f += d;
00060 f += "/.xmlirc.xml";
00061
00062 int nread = 0;
00063 nread += xmli::ReadFile(f.c_str(),true);
00064
00065 return nread;
00066 }
|
|
|
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 184 of file xmli.cxx. References gsPath, and xmli::ChString::Split(). Referenced by Initialize().
00185 {
00186 std::string path;
00187 const char* mxpath = getenv("XMLI_PATH");
00188 const char* srtpub = getenv("SRT_PUBLIC_CONTEXT");
00189 const char* srtpri = getenv("SRT_PRIVATE_CONTEXT");
00190
00191 if (mxpath) {
00192 path += mxpath;
00193 path += ":";
00194 }
00195 path += "./";
00196 if (srtpri) {
00197 path += ":";
00198 path += srtpri;
00199 path += "/xml";
00200 }
00201 if (srtpub) {
00202 if (srtpri) path += ":";
00203 path += srtpub;
00204 path += "/xml";
00205 }
00206 xmli::ChString::Split(path.c_str(),":",gsPath);
00207 }
|
|
|
Read all XML files contained inside a particular directory
Definition at line 112 of file xmli.cxx. References ReadFile(). Referenced by main().
00113 {
00114 int i, n;
00115 int nread = 0;
00116 struct dirent** namelist;
00117
00118 n = scandir(dir, &namelist, 0, alphasort);
00119 if (n<1) return 0;
00120 for (i=0; i<n; ++i) {
00121 if (fnmatch("*.xml",namelist[i]->d_name,0)==0) {
00122 std::string nm = dir; nm += "/"; nm += namelist[i]->d_name;
00123 nread += xmli::ReadFile(nm.c_str(), true);
00124 }
00125 free(namelist[i]);
00126 }
00127 free(namelist);
00128 return nread;
00129 }
|
|
||||||||||||
|
Parse the entire contents of an XML file
Definition at line 92 of file xmli.cxx. References FindFile(), and xmli::Parser::ParseFile(). Referenced by xmli::xmlfileBuilder::Build(), Initialize(), main(), evdb::JobMenu::OpenJobXML(), and ReadDirectory().
00093 {
00094 int nread = 0;
00095 xmli::Parser p;
00096 const char* f = xmli::FindFile(file, absname);
00097 if (f) {
00098 // std::cout << "xmli: Load file '" << f << "'" << std::endl;
00099 p.ParseFile(f);
00100 ++nread;
00101 }
00102 return nread;
00103 }
|
|
|
Parse a string containing XML tags
Definition at line 76 of file xmli.cxx. References xmli::Parser::ParseText(). Referenced by evdb::CfgEdit::EditConfig().
00077 {
00078 xmli::Parser p;
00079 p.ParseText(text);
00080 return 1;
00081 }
|
1.3.5