ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/Search/Indexer.cpp
(Generate patch)

Comparing trunk/Search/Indexer.cpp (file contents):
Revision 34 by douglas, 2003-01-02T19:42:33-08:00 vs.
Revision 35 by douglas, 2003-01-16T17:27:03-08:00

# Line 60 | Line 60 | Indexer::Indexer(string& indexFile, set<
60  
61   void Indexer::index(string& begin)
62   {
63 +        unsigned separator = indexFile.rfind(slash);
64 +        string dtd = separator != string::npos ? indexFile.substr(0, separator) +
65 +                slash + "index.dtd" : "index.dtd";
66 +
67 +        ifstream fin(dtd.c_str());
68 +
69 +        if (!fin.is_open())
70 +        {
71 +                ofstream fout(dtd.c_str());
72 +
73 +                fout << "<!ELEMENT index (page*)>\n"
74 +                        << "<!ELEMENT page (address, port?, path, title?, description?, ke"
75 +                        << "ywords?, text,\n"
76 +                        << "    heading*)\n"
77 +                        << ">\n"
78 +                        << "<!ELEMENT address (#PCDATA)>\n"
79 +                        << "<!ELEMENT port (#PCDATA)>\n"
80 +                        << "<!ELEMENT path (#PCDATA)>\n"
81 +                        << "<!ELEMENT size (#PCDATA)>\n"
82 +                        << "<!ELEMENT title (#PCDATA)>\n"
83 +                        << "<!ELEMENT description (#PCDATA)>\n"
84 +                        << "<!ELEMENT text (#PCDATA)>\n"
85 +                        << "<!ELEMENT heading (#PCDATA)>\n";
86 +
87 +                fout.close();
88 +        }
89 +
90 +        fin.close();
91 +
92          ofstream fout(indexFile.c_str());
93  
94          fout << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"no\"?>"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines