223 |
|
|
224 |
|
void SiteMapper::newMap(const string& siteMap) |
225 |
|
{ |
226 |
+ |
ofstream fout(siteMap.c_str()); |
227 |
+ |
|
228 |
+ |
fout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
229 |
+ |
<< "<?xml-stylesheet type=\"text/xsl\" href=\"stylesheets/sitemap.xsl" |
230 |
+ |
<< "\"?>\n" |
231 |
+ |
<< "<!DOCTYPE page SYSTEM \"stylesheets/page.dtd\">\n" |
232 |
+ |
<< "<!-- /sitemap.xml -->\n" |
233 |
+ |
<< "<page>\n" |
234 |
+ |
<< "\t<title>Sitemap</title>\n" |
235 |
+ |
<< "\t<section>\n" |
236 |
+ |
<< "\t\t<list>\n"; |
237 |
+ |
|
238 |
|
for (unsigned index = 0; index < pages.size(); index++) |
239 |
|
{ |
240 |
|
if (newPages.find(pages[index].getAddress()) != newPages.end()) |
243 |
|
newPages.find(pages[index].getAddress())->second); |
244 |
|
} |
245 |
|
|
246 |
< |
cout << pages[index] << '\n'; |
246 |
> |
fout << pages[index](3) << '\n'; |
247 |
|
} |
248 |
+ |
|
249 |
+ |
fout << "\t\t</list>\n" |
250 |
+ |
<< "\t</section>\n" |
251 |
+ |
<< "</page>\n"; |
252 |
+ |
|
253 |
+ |
fout.close(); |
254 |
|
} |
255 |
|
|
256 |
|
void SiteMapper::newMap(vector<Page>& pages, const string& childOf, |