80 |
|
item = evaluator.createXPath(XalanDOMString("item").c_str()); |
81 |
|
address = evaluator.createXPath(XalanDOMString("link/@address").c_str()); |
82 |
|
link = evaluator.createXPath(XalanDOMString("link").c_str()); |
83 |
< |
this->list = evaluator.createXPath(XalanDOMString("list").c_str()); |
83 |
> |
list_ = evaluator.createXPath(XalanDOMString("list").c_str()); |
84 |
|
|
85 |
|
oldMap(pages, list); |
86 |
|
|
87 |
|
evaluator.destroyXPath(item); |
88 |
|
evaluator.destroyXPath(address); |
89 |
|
evaluator.destroyXPath(link); |
90 |
< |
evaluator.destroyXPath(this->list); |
90 |
> |
evaluator.destroyXPath(list_); |
91 |
|
} |
92 |
|
|
93 |
< |
void SiteMapper::oldMap(vector<Page>& pages, XalanNode* list) |
93 |
> |
void SiteMapper::oldMap(vector<Page>& pages, XalanNode* list_) |
94 |
|
{ |
95 |
< |
NodeRefList nodes = evaluator.selectNodeList(support, list, *item); |
95 |
> |
NodeRefList nodes = evaluator.selectNodeList(support, list_, *item); |
96 |
|
|
97 |
|
for (int index = 0; index < nodes.getLength(); index++) |
98 |
|
{ |
99 |
|
XalanNode* node = nodes.item(index); |
100 |
|
ostringstream url, title; |
101 |
< |
|
101 |
> |
|
102 |
|
url << evaluator.evaluate(support, node, *address)->str(); |
103 |
|
title << evaluator.evaluate(support, node, *link)->str(); |
104 |
|
|
105 |
|
Page page(url.str(), title.str()); |
106 |
|
XalanNode* list = evaluator.selectSingleNode(support, node, |
107 |
< |
*(this->list)); |
107 |
> |
*(this->list_)); |
108 |
|
|
109 |
|
if (list != 0) oldMap(page.getChildren(), list); |
110 |
|
|
125 |
|
port = evaluator.createXPath(XalanDOMString("port").c_str()); |
126 |
|
path = evaluator.createXPath(XalanDOMString("path").c_str()); |
127 |
|
title = evaluator.createXPath(XalanDOMString("title").c_str()); |
128 |
< |
|
128 |
> |
|
129 |
|
NodeRefList nodes = evaluator.selectNodeList(support, document, |
130 |
|
XalanDOMString("/index/page").c_str()); |
131 |
|
|
143 |
|
address << ':' << int(port); |
144 |
|
} |
145 |
|
|
146 |
< |
cerr << address.str() << '\n'; |
146 |
> |
ostringstream path, title; |
147 |
> |
|
148 |
> |
path << evaluator.evaluate(support, node, *(this->path))->str(); |
149 |
> |
title << evaluator.evaluate(support, node, *(this->title))->str(); |
150 |
> |
|
151 |
> |
Page page(address.str(), path.str(), title.str()); |
152 |
> |
Matcher matcher("^Douglas Thrift's.+Website \\| (.+)$"); |
153 |
> |
|
154 |
> |
if (page == matcher) |
155 |
> |
{ |
156 |
> |
page.setTitle(matcher[1]); |
157 |
> |
|
158 |
> |
newPages.insert(page); |
159 |
> |
} |
160 |
|
} |
161 |
|
|
162 |
|
evaluator.destroyXPath(address); |
169 |
|
{ |
170 |
|
// |
171 |
|
|
172 |
< |
// for (int index = 0; index < pages.size(); index++) |
173 |
< |
// { |
174 |
< |
// cout << pages[index] << '\n'; |
175 |
< |
// } |
172 |
> |
for (unsigned index = 0; index < pages.size(); index++) |
173 |
> |
{ |
174 |
> |
cout << pages[index] << '\n'; |
175 |
> |
} |
176 |
|
} |